[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: chown/quota bug in ext3



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;





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]