diff options
| -rw-r--r-- | fs/nfs/nfs4proc.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index f23977e4ac0f..15fc7e4664ed 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
| @@ -2549,6 +2549,14 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, | |||
| 2549 | 2549 | ||
| 2550 | nfs_fattr_init(fattr); | 2550 | nfs_fattr_init(fattr); |
| 2551 | 2551 | ||
| 2552 | /* Deal with open(O_TRUNC) */ | ||
| 2553 | if (sattr->ia_valid & ATTR_OPEN) | ||
| 2554 | sattr->ia_valid &= ~(ATTR_MTIME|ATTR_CTIME|ATTR_OPEN); | ||
| 2555 | |||
| 2556 | /* Optimization: if the end result is no change, don't RPC */ | ||
| 2557 | if ((sattr->ia_valid & ~(ATTR_FILE)) == 0) | ||
| 2558 | return 0; | ||
| 2559 | |||
| 2552 | /* Search for an existing open(O_WRITE) file */ | 2560 | /* Search for an existing open(O_WRITE) file */ |
| 2553 | if (sattr->ia_valid & ATTR_FILE) { | 2561 | if (sattr->ia_valid & ATTR_FILE) { |
| 2554 | struct nfs_open_context *ctx; | 2562 | struct nfs_open_context *ctx; |
| @@ -2560,10 +2568,6 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, | |||
| 2560 | } | 2568 | } |
| 2561 | } | 2569 | } |
| 2562 | 2570 | ||
| 2563 | /* Deal with open(O_TRUNC) */ | ||
| 2564 | if (sattr->ia_valid & ATTR_OPEN) | ||
| 2565 | sattr->ia_valid &= ~(ATTR_MTIME|ATTR_CTIME|ATTR_OPEN); | ||
| 2566 | |||
| 2567 | status = nfs4_do_setattr(inode, cred, fattr, sattr, state); | 2571 | status = nfs4_do_setattr(inode, cred, fattr, sattr, state); |
| 2568 | if (status == 0) | 2572 | if (status == 0) |
| 2569 | nfs_setattr_update_inode(inode, sattr); | 2573 | nfs_setattr_update_inode(inode, sattr); |
