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>
This commit is contained in:
committed by
Boaz Harrosh
parent
cbe8260369
commit
8a1636c459
@@ -2361,6 +2361,9 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
|
|||||||
struct nfs4_state *state = NULL;
|
struct nfs4_state *state = NULL;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
if (pnfs_ld_layoutret_on_setattr(inode))
|
||||||
|
pnfs_return_layout(inode);
|
||||||
|
|
||||||
nfs_fattr_init(fattr);
|
nfs_fattr_init(fattr);
|
||||||
|
|
||||||
/* Search for an existing open(O_WRITE) file */
|
/* Search for an existing open(O_WRITE) file */
|
||||||
|
@@ -964,6 +964,7 @@ objlayout_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
|
|||||||
static struct pnfs_layoutdriver_type objlayout_type = {
|
static struct pnfs_layoutdriver_type objlayout_type = {
|
||||||
.id = LAYOUT_OSD2_OBJECTS,
|
.id = LAYOUT_OSD2_OBJECTS,
|
||||||
.name = "LAYOUT_OSD2_OBJECTS",
|
.name = "LAYOUT_OSD2_OBJECTS",
|
||||||
|
.flags = PNFS_LAYOUTRET_ON_SETATTR,
|
||||||
|
|
||||||
.alloc_layout_hdr = objlayout_alloc_layout_hdr,
|
.alloc_layout_hdr = objlayout_alloc_layout_hdr,
|
||||||
.free_layout_hdr = objlayout_free_layout_hdr,
|
.free_layout_hdr = objlayout_free_layout_hdr,
|
||||||
|
@@ -65,6 +65,11 @@ enum {
|
|||||||
NFS_LAYOUT_DESTROYED, /* no new use of layout allowed */
|
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;
|
struct nfs4_deviceid_node;
|
||||||
|
|
||||||
/* Per-layout driver specific registration structure */
|
/* Per-layout driver specific registration structure */
|
||||||
@@ -73,6 +78,7 @@ struct pnfs_layoutdriver_type {
|
|||||||
const u32 id;
|
const u32 id;
|
||||||
const char *name;
|
const char *name;
|
||||||
struct module *owner;
|
struct module *owner;
|
||||||
|
unsigned flags;
|
||||||
|
|
||||||
struct pnfs_layout_hdr * (*alloc_layout_hdr) (struct inode *inode, gfp_t gfp_flags);
|
struct pnfs_layout_hdr * (*alloc_layout_hdr) (struct inode *inode, gfp_t gfp_flags);
|
||||||
void (*free_layout_hdr) (struct pnfs_layout_hdr *);
|
void (*free_layout_hdr) (struct pnfs_layout_hdr *);
|
||||||
@@ -258,6 +264,16 @@ static inline void pnfs_clear_request_commit(struct nfs_page *req)
|
|||||||
put_lseg(req->wb_commit_lseg);
|
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)
|
static inline int pnfs_return_layout(struct inode *ino)
|
||||||
{
|
{
|
||||||
struct nfs_inode *nfsi = NFS_I(ino);
|
struct nfs_inode *nfsi = NFS_I(ino);
|
||||||
@@ -316,6 +332,12 @@ static inline int pnfs_return_layout(struct inode *ino)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool
|
||||||
|
pnfs_ld_layoutret_on_setattr(struct inode *inode)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
pnfs_roc(struct inode *ino)
|
pnfs_roc(struct inode *ino)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user