summaryrefslogtreecommitdiffstats
path: root/fs/ufs/truncate.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2010-03-03 09:05:02 -0500
committerJan Kara <jack@suse.cz>2010-03-05 00:20:28 +0100
commit759bfee658beab14af7b357156461d0eb852be2c (patch)
tree180cdedd004781ee67c30ce89951324d32910067 /fs/ufs/truncate.c
parent63936ddaa16b9486e2d426ed7b09f559a5c60f87 (diff)
downloadlinux-759bfee658beab14af7b357156461d0eb852be2c.tar.bz2
dquot: move dquot transfer responsibility into the filesystem
Currently notify_change calls vfs_dq_transfer directly. This means we tie the quota code into the VFS. Get rid of that and make the filesystem responsible for the transfer. Most filesystems already do this, only ufs and udf need the code added, and for jfs it needs to be enabled unconditionally instead of only when ACLs are enabled. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ufs/truncate.c')
-rw-r--r--fs/ufs/truncate.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c
index 41dd431ce228..56ab31f00bd0 100644
--- a/fs/ufs/truncate.c
+++ b/fs/ufs/truncate.c
@@ -44,6 +44,7 @@
#include <linux/buffer_head.h>
#include <linux/blkdev.h>
#include <linux/sched.h>
+#include <linux/quotaops.h>
#include "ufs_fs.h"
#include "ufs.h"
@@ -517,6 +518,12 @@ static int ufs_setattr(struct dentry *dentry, struct iattr *attr)
if (error)
return error;
+ if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
+ (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
+ error = vfs_dq_transfer(inode, attr) ? -EDQUOT : 0;
+ if (error)
+ return error;
+ }
if (ia_valid & ATTR_SIZE &&
attr->ia_size != i_size_read(inode)) {
loff_t old_i_size = inode->i_size;