diff options
author | Benny Halevy <bhalevy@panasas.com> | 2010-07-14 15:43:57 -0400 |
---|---|---|
committer | Boaz Harrosh <bharrosh@panasas.com> | 2011-05-29 13:54:36 -0400 |
commit | 8a1636c459cb7a4b32ba4024cd1b2ba21fba6aed (patch) | |
tree | f9c46f272b98ceb65f997f226d47da68c6fcac6b /fs/nfs | |
parent | cbe8260369c9f88eafa035cd327dc3e02fad528c (diff) |
pnfs: layoutret_on_setattr
With the objects layout security model, we have object capabilities
that are associated with the layout and we anticipate that the server
will issue a cb_layoutrecall for any setattr that changes security
related attributes (user/group/mode/acl) or truncates the file.
Therefore, the layout is returned before issuing the setattr to avoid
the anticipated cb_layoutrecall.
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/nfs4proc.c | 3 | ||||
-rw-r--r-- | fs/nfs/objlayout/objio_osd.c | 1 | ||||
-rw-r--r-- | fs/nfs/pnfs.h | 22 |
3 files changed, 26 insertions, 0 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 5b4124e4c22f..57340096c737 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -2361,6 +2361,9 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, | |||
2361 | struct nfs4_state *state = NULL; | 2361 | struct nfs4_state *state = NULL; |
2362 | int status; | 2362 | int status; |
2363 | 2363 | ||
2364 | if (pnfs_ld_layoutret_on_setattr(inode)) | ||
2365 | pnfs_return_layout(inode); | ||
2366 | |||
2364 | nfs_fattr_init(fattr); | 2367 | nfs_fattr_init(fattr); |
2365 | 2368 | ||
2366 | /* Search for an existing open(O_WRITE) file */ | 2369 | /* Search for an existing open(O_WRITE) file */ |
diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c index cc92d3b3dc3a..4e8de3ec9a63 100644 --- a/fs/nfs/objlayout/objio_osd.c +++ b/fs/nfs/objlayout/objio_osd.c | |||
@@ -964,6 +964,7 @@ objlayout_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev, | |||
964 | static struct pnfs_layoutdriver_type objlayout_type = { | 964 | static struct pnfs_layoutdriver_type objlayout_type = { |
965 | .id = LAYOUT_OSD2_OBJECTS, | 965 | .id = LAYOUT_OSD2_OBJECTS, |
966 | .name = "LAYOUT_OSD2_OBJECTS", | 966 | .name = "LAYOUT_OSD2_OBJECTS", |
967 | .flags = PNFS_LAYOUTRET_ON_SETATTR, | ||
967 | 968 | ||
968 | .alloc_layout_hdr = objlayout_alloc_layout_hdr, | 969 | .alloc_layout_hdr = objlayout_alloc_layout_hdr, |
969 | .free_layout_hdr = objlayout_free_layout_hdr, | 970 | .free_layout_hdr = objlayout_free_layout_hdr, |
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index c34f7a0e3bc2..af3967a893a1 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h | |||
@@ -65,6 +65,11 @@ enum { | |||
65 | NFS_LAYOUT_DESTROYED, /* no new use of layout allowed */ | 65 | NFS_LAYOUT_DESTROYED, /* no new use of layout allowed */ |
66 | }; | 66 | }; |
67 | 67 | ||
68 | enum layoutdriver_policy_flags { | ||
69 | /* Should the pNFS client commit and return the layout upon a setattr */ | ||
70 | PNFS_LAYOUTRET_ON_SETATTR = 1 << 0, | ||
71 | }; | ||
72 | |||
68 | struct nfs4_deviceid_node; | 73 | struct nfs4_deviceid_node; |
69 | 74 | ||
70 | /* Per-layout driver specific registration structure */ | 75 | /* Per-layout driver specific registration structure */ |
@@ -73,6 +78,7 @@ struct pnfs_layoutdriver_type { | |||
73 | const u32 id; | 78 | const u32 id; |
74 | const char *name; | 79 | const char *name; |
75 | struct module *owner; | 80 | struct module *owner; |
81 | unsigned flags; | ||
76 | 82 | ||
77 | struct pnfs_layout_hdr * (*alloc_layout_hdr) (struct inode *inode, gfp_t gfp_flags); | 83 | struct pnfs_layout_hdr * (*alloc_layout_hdr) (struct inode *inode, gfp_t gfp_flags); |
78 | void (*free_layout_hdr) (struct pnfs_layout_hdr *); | 84 | void (*free_layout_hdr) (struct pnfs_layout_hdr *); |
@@ -258,6 +264,16 @@ static inline void pnfs_clear_request_commit(struct nfs_page *req) | |||
258 | put_lseg(req->wb_commit_lseg); | 264 | put_lseg(req->wb_commit_lseg); |
259 | } | 265 | } |
260 | 266 | ||
267 | /* Should the pNFS client commit and return the layout upon a setattr */ | ||
268 | static inline bool | ||
269 | pnfs_ld_layoutret_on_setattr(struct inode *inode) | ||
270 | { | ||
271 | if (!pnfs_enabled_sb(NFS_SERVER(inode))) | ||
272 | return false; | ||
273 | return NFS_SERVER(inode)->pnfs_curr_ld->flags & | ||
274 | PNFS_LAYOUTRET_ON_SETATTR; | ||
275 | } | ||
276 | |||
261 | static inline int pnfs_return_layout(struct inode *ino) | 277 | static inline int pnfs_return_layout(struct inode *ino) |
262 | { | 278 | { |
263 | struct nfs_inode *nfsi = NFS_I(ino); | 279 | struct nfs_inode *nfsi = NFS_I(ino); |
@@ -317,6 +333,12 @@ static inline int pnfs_return_layout(struct inode *ino) | |||
317 | } | 333 | } |
318 | 334 | ||
319 | static inline bool | 335 | static inline bool |
336 | pnfs_ld_layoutret_on_setattr(struct inode *inode) | ||
337 | { | ||
338 | return false; | ||
339 | } | ||
340 | |||
341 | static inline bool | ||
320 | pnfs_roc(struct inode *ino) | 342 | pnfs_roc(struct inode *ino) |
321 | { | 343 | { |
322 | return false; | 344 | return false; |