mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
locks: break delegations on any attribute modification
NFSv4 uses leases to guarantee that clients can cache metadata as well as data. Cc: Mikulas Patocka <[email protected]> Cc: David Howells <[email protected]> Cc: Tyler Hicks <[email protected]> Cc: Dustin Kirkland <[email protected]> Acked-by: Jeff Layton <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]> Signed-off-by: Al Viro <[email protected]>
This commit is contained in:
parent
146a8595c6
commit
27ac0ffeac
10 changed files with 69 additions and 17 deletions
25
fs/attr.c
25
fs/attr.c
|
|
@ -167,7 +167,27 @@ void setattr_copy(struct inode *inode, const struct iattr *attr)
|
|||
}
|
||||
EXPORT_SYMBOL(setattr_copy);
|
||||
|
||||
int notify_change(struct dentry * dentry, struct iattr * attr)
|
||||
/**
|
||||
* notify_change - modify attributes of a filesytem object
|
||||
* @dentry: object affected
|
||||
* @iattr: new attributes
|
||||
* @delegated_inode: returns inode, if the inode is delegated
|
||||
*
|
||||
* The caller must hold the i_mutex on the affected object.
|
||||
*
|
||||
* If notify_change discovers a delegation in need of breaking,
|
||||
* it will return -EWOULDBLOCK and return a reference to the inode in
|
||||
* delegated_inode. The caller should then break the delegation and
|
||||
* retry. Because breaking a delegation may take a long time, the
|
||||
* caller should drop the i_mutex before doing so.
|
||||
*
|
||||
* Alternatively, a caller may pass NULL for delegated_inode. This may
|
||||
* be appropriate for callers that expect the underlying filesystem not
|
||||
* to be NFS exported. Also, passing NULL is fine for callers holding
|
||||
* the file open for write, as there can be no conflicting delegation in
|
||||
* that case.
|
||||
*/
|
||||
int notify_change(struct dentry * dentry, struct iattr * attr, struct inode **delegated_inode)
|
||||
{
|
||||
struct inode *inode = dentry->d_inode;
|
||||
umode_t mode = inode->i_mode;
|
||||
|
|
@ -241,6 +261,9 @@ int notify_change(struct dentry * dentry, struct iattr * attr)
|
|||
return 0;
|
||||
|
||||
error = security_inode_setattr(dentry, attr);
|
||||
if (error)
|
||||
return error;
|
||||
error = try_break_deleg(inode, delegated_inode);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue