* [PATCH 3/5] NFS: Check size by inode_newsize_ok in nfs_setattr
@ 2015-07-28 11:13 Kinglong Mee
0 siblings, 0 replies; only message in thread
From: Kinglong Mee @ 2015-07-28 11:13 UTC (permalink / raw)
To: Trond Myklebust, linux-nfs@vger.kernel.org; +Cc: osandov, kinglongmee
Set rlimit for NFS's files is useless right now.
For local process's rlimit, it should be checked by nfs client.
The same, CIFS also call inode_change_ok checking rlimit at its client
in cifs_setattr_nounix() and cifs_setattr_unix().
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
fs/nfs/inode.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index b77b328..eed6104 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -512,15 +512,14 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr)
attr->ia_valid &= ~ATTR_MODE;
if (attr->ia_valid & ATTR_SIZE) {
- loff_t i_size;
-
BUG_ON(!S_ISREG(inode->i_mode));
- i_size = i_size_read(inode);
- if (attr->ia_size == i_size)
+ error = inode_newsize_ok(inode, attr->ia_size);
+ if (error)
+ return error;
+
+ if (attr->ia_size == i_size_read(inode))
attr->ia_valid &= ~ATTR_SIZE;
- else if (attr->ia_size < i_size && IS_SWAPFILE(inode))
- return -ETXTBSY;
}
/* Optimization: if the end result is no change, don't RPC */
--
2.4.3
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-07-28 11:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-28 11:13 [PATCH 3/5] NFS: Check size by inode_newsize_ok in nfs_setattr Kinglong Mee
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.