Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 320216
b: refs/heads/master
c: 293b3b0
h: refs/heads/master
v: v3
  • Loading branch information
Andy Adamson authored and Trond Myklebust committed Jul 16, 2012
1 parent d4b624c commit 773aa53
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 366d50521c57939e61e25dc27f009367447563e6
refs/heads/master: 293b3b065c5ec5d15c3087ca42a52c991d7d8235
23 changes: 19 additions & 4 deletions trunk/fs/nfs/pnfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,14 @@ send_layoutget(struct pnfs_layout_hdr *lo,
return NULL;
}

/* Initiates a LAYOUTRETURN(FILE) */
/*
* Initiates a LAYOUTRETURN(FILE), and removes the pnfs_layout_hdr
* when the layout segment list is empty.
*
* Note that a pnfs_layout_hdr can exist with an empty layout segment
* list when LAYOUTGET has failed, or when LAYOUTGET succeeded, but the
* deviceid is marked invalid.
*/
int
_pnfs_return_layout(struct inode *ino)
{
Expand All @@ -660,21 +667,29 @@ _pnfs_return_layout(struct inode *ino)
LIST_HEAD(tmp_list);
struct nfs4_layoutreturn *lrp;
nfs4_stateid stateid;
int status = 0;
int status = 0, empty;

dprintk("NFS: %s for inode %lu\n", __func__, ino->i_ino);

spin_lock(&ino->i_lock);
lo = nfsi->layout;
if (!lo || pnfs_test_layout_returned(lo)) {
spin_unlock(&ino->i_lock);
dprintk("%s: no layout to return\n", __func__);
return status;
dprintk("NFS: %s no layout to return\n", __func__);
goto out;
}
stateid = nfsi->layout->plh_stateid;
/* Reference matched in nfs4_layoutreturn_release */
get_layout_hdr(lo);
empty = list_empty(&lo->plh_segs);
mark_matching_lsegs_invalid(lo, &tmp_list, NULL);
/* Don't send a LAYOUTRETURN if list was initially empty */
if (empty) {
spin_unlock(&ino->i_lock);
put_layout_hdr(lo);
dprintk("NFS: %s no layout segments to return\n", __func__);
goto out;
}
lo->plh_block_lgets++;
pnfs_mark_layout_returned(lo);
spin_unlock(&ino->i_lock);
Expand Down

0 comments on commit 773aa53

Please sign in to comment.