QUOTA [with patch this time]

Dan Merillat (Dan@merillat.org)
Fri, 13 Dec 1996 21:01:55 -0500 (EST)


Ok, I decided to jump into the source and actually make a patch.
This (should) only let the owner hardlink a file IFF the file resides
on a filesystem with disk quotas.

Hey, don't try this on your ISP until someone who knows VFS better then me
ok's it, but it compiles cleanly at least. ;-)

Alan: Does this look like it does what I think it is supposed to? ;-)

I'm making the assumption that do_link is running as the user (current->fsuid
= the uid of the calling process)

Also from what I understand, only filesystems with inode->i_sb->dq_op
existant have quota enabled.

--Dan

--- orig-2.0.27/fs/namei.c Fri Sep 20 10:00:35 1996
+++ linux/fs/namei.c Fri Dec 13 20:52:57 1996
@@ -803,8 +803,14 @@
return -EPERM;
}
dir->i_count++;
- if (dir->i_sb && dir->i_sb->dq_op)
+ if (dir->i_sb && dir->i_sb->dq_op) {
+ if ((oldinode->i_uid != current->fsuid) && !fsuser()) {
+ iput(dir);
+ iput(oldinode);
+ return -EPERM;
+ }
dir->i_sb->dq_op->initialize(dir, -1);
+ }
down(&dir->i_sem);
error = dir->i_op->link(oldinode, dir, basename, namelen);
up(&dir->i_sem);