diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-07-08 00:53:00 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-07-08 00:53:00 +0000 |
commit | b8553086288629b4efb77e97f5582e08bc50ad65 (patch) | |
tree | 0a19bd1c21e148f35c7a0f76baa4f7a056b966b0 /fs/dquot.c | |
parent | 75b6d92f2dd5112b02f4e78cf9f35f9825946ef0 (diff) |
Merge with 2.4.0-test3-pre4.
Diffstat (limited to 'fs/dquot.c')
-rw-r--r-- | fs/dquot.c | 67 |
1 files changed, 38 insertions, 29 deletions
diff --git a/fs/dquot.c b/fs/dquot.c index 56824a73a..022dd3423 100644 --- a/fs/dquot.c +++ b/fs/dquot.c @@ -1027,40 +1027,43 @@ void dquot_initialize(struct inode *inode, short type) unsigned int id = 0; short cnt; - if (S_ISREG(inode->i_mode) || - S_ISDIR(inode->i_mode) || - S_ISLNK(inode->i_mode)) { - /* We don't want to have quotas on quota files - nasty deadlocks possible */ - if (is_quotafile(inode)) - return; - for (cnt = 0; cnt < MAXQUOTAS; cnt++) { - if (type != -1 && cnt != type) - continue; + if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode) && + !S_ISLNK(inode->i_mode)) + return; + lock_kernel(); + /* We don't want to have quotas on quota files - nasty deadlocks possible */ + if (is_quotafile(inode)) { + unlock_kernel(); + return; + } + for (cnt = 0; cnt < MAXQUOTAS; cnt++) { + if (type != -1 && cnt != type) + continue; - if (!sb_has_quota_enabled(inode->i_sb, cnt)) - continue; + if (!sb_has_quota_enabled(inode->i_sb, cnt)) + continue; - if (inode->i_dquot[cnt] == NODQUOT) { - switch (cnt) { - case USRQUOTA: - id = inode->i_uid; - break; - case GRPQUOTA: - id = inode->i_gid; - break; - } - dquot = dqget(inode->i_sb, id, cnt); - if (dquot == NODQUOT) - continue; - if (inode->i_dquot[cnt] != NODQUOT) { - dqput(dquot); - continue; - } - inode->i_dquot[cnt] = dquot; - inode->i_flags |= S_QUOTA; + if (inode->i_dquot[cnt] == NODQUOT) { + switch (cnt) { + case USRQUOTA: + id = inode->i_uid; + break; + case GRPQUOTA: + id = inode->i_gid; + break; } + dquot = dqget(inode->i_sb, id, cnt); + if (dquot == NODQUOT) + continue; + if (inode->i_dquot[cnt] != NODQUOT) { + dqput(dquot); + continue; + } + inode->i_dquot[cnt] = dquot; + inode->i_flags |= S_QUOTA; } } + unlock_kernel(); } /* @@ -1073,6 +1076,7 @@ void dquot_drop(struct inode *inode) struct dquot *dquot; short cnt; + lock_kernel(); inode->i_flags &= ~S_QUOTA; for (cnt = 0; cnt < MAXQUOTAS; cnt++) { if (inode->i_dquot[cnt] == NODQUOT) @@ -1081,6 +1085,7 @@ void dquot_drop(struct inode *inode) inode->i_dquot[cnt] = NODQUOT; dqput(dquot); } + unlock_kernel(); } /* @@ -1208,6 +1213,8 @@ int dquot_transfer(struct dentry *dentry, struct iattr *iattr) /* Arguably we could consider that as error, but... no fs - no quota */ if (!inode->i_sb) return 0; + + lock_kernel(); /* * Find out if this filesystem uses i_blocks. */ @@ -1315,6 +1322,7 @@ int dquot_transfer(struct dentry *dentry, struct iattr *iattr) } } + unlock_kernel(); return 0; put_all: for (disc = 0; disc < cnt; disc++) { @@ -1328,6 +1336,7 @@ put_all: dqput(transfer_from[disc]); } } + unlock_kernel(); return error; } |