Hi, there appears to be a bug w.r.t. chown and quotas in ext3. In particular, if you "chown" a file on a filesystem with userquotas enabled, the quota charge in not transfered. ditto "chgrp" and group quotas. This happens because i_op->setattr has been redefined for files, and ext3_setattr doesn't do the DQUOT_TRANSFER like it should. I have fixed it by adding a stanza like: if ((attr->ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || (attr->ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) error = DQUOT_TRANSFER(inode, attr) ? -EDQUOT : 0; if (error) return error; into ext3_setattr just after: error = inode_change_ok(inode, attr); if (error) return error; though possibly it should go just before the: rc = inode_setattr(inode, attr); instead. NeilBrown
Neil Brown wrote:> > Hi, > there appears to be a bug w.r.t. chown and quotas in ext3. >oops. Thanks - I bet that took a while to hunt down. How does this look? --- linux-2.4.17-pre5/fs/ext3/inode.c Thu Nov 22 23:02:58 2001 +++ linux-akpm/fs/ext3/inode.c Thu Dec 6 23:39:28 2001 @@ -2333,12 +2333,20 @@ void ext3_write_inode(struct inode *inod int ext3_setattr(struct dentry *dentry, struct iattr *attr) { struct inode *inode = dentry->d_inode; int error, rc; + const unsigned int ia_valid = attr->ia_valid; error = inode_change_ok(inode, 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 = DQUOT_TRANSFER(inode, attr) ? -EDQUOT : 0; + if (error) + return error; + } + if (attr->ia_valid & ATTR_SIZE && attr->ia_size < inode->i_size) { handle_t *handle;