Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 252906
b: refs/heads/master
c: 8a1636c
h: refs/heads/master
v: v3
  • Loading branch information
Benny Halevy authored and Boaz Harrosh committed May 29, 2011
1 parent 8064a12 commit 7611a33
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cbe8260369c9f88eafa035cd327dc3e02fad528c
refs/heads/master: 8a1636c459cb7a4b32ba4024cd1b2ba21fba6aed
3 changes: 3 additions & 0 deletions trunk/fs/nfs/nfs4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2361,6 +2361,9 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
struct nfs4_state *state = NULL;
int status;

if (pnfs_ld_layoutret_on_setattr(inode))
pnfs_return_layout(inode);

nfs_fattr_init(fattr);

/* Search for an existing open(O_WRITE) file */
Expand Down
1 change: 1 addition & 0 deletions trunk/fs/nfs/objlayout/objio_osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,7 @@ objlayout_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
static struct pnfs_layoutdriver_type objlayout_type = {
.id = LAYOUT_OSD2_OBJECTS,
.name = "LAYOUT_OSD2_OBJECTS",
.flags = PNFS_LAYOUTRET_ON_SETATTR,

.alloc_layout_hdr = objlayout_alloc_layout_hdr,
.free_layout_hdr = objlayout_free_layout_hdr,
Expand Down
22 changes: 22 additions & 0 deletions trunk/fs/nfs/pnfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ enum {
NFS_LAYOUT_DESTROYED, /* no new use of layout allowed */
};

enum layoutdriver_policy_flags {
/* Should the pNFS client commit and return the layout upon a setattr */
PNFS_LAYOUTRET_ON_SETATTR = 1 << 0,
};

struct nfs4_deviceid_node;

/* Per-layout driver specific registration structure */
Expand All @@ -73,6 +78,7 @@ struct pnfs_layoutdriver_type {
const u32 id;
const char *name;
struct module *owner;
unsigned flags;

struct pnfs_layout_hdr * (*alloc_layout_hdr) (struct inode *inode, gfp_t gfp_flags);
void (*free_layout_hdr) (struct pnfs_layout_hdr *);
Expand Down Expand Up @@ -258,6 +264,16 @@ static inline void pnfs_clear_request_commit(struct nfs_page *req)
put_lseg(req->wb_commit_lseg);
}

/* Should the pNFS client commit and return the layout upon a setattr */
static inline bool
pnfs_ld_layoutret_on_setattr(struct inode *inode)
{
if (!pnfs_enabled_sb(NFS_SERVER(inode)))
return false;
return NFS_SERVER(inode)->pnfs_curr_ld->flags &
PNFS_LAYOUTRET_ON_SETATTR;
}

static inline int pnfs_return_layout(struct inode *ino)
{
struct nfs_inode *nfsi = NFS_I(ino);
Expand Down Expand Up @@ -316,6 +332,12 @@ static inline int pnfs_return_layout(struct inode *ino)
return 0;
}

static inline bool
pnfs_ld_layoutret_on_setattr(struct inode *inode)
{
return false;
}

static inline bool
pnfs_roc(struct inode *ino)
{
Expand Down

0 comments on commit 7611a33

Please sign in to comment.