aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2005-01-03 04:12:24 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-01-03 04:12:24 -0800
commitcf684334cbbc8406337727d3f4be722b4fb49c4b (patch)
tree76e4abec85fd7b0873f8b61d4de64f2c2e093e63 /security
parent6ffc2881a0afacddc11a8fae357166bb00aafe47 (diff)
downloadhistory-cf684334cbbc8406337727d3f4be722b4fb49c4b.tar.gz
[PATCH] Fix of quota deadlock on pagelock: quota core
The four patches in this series fix deadlocks with quotas of pagelock (the problem was lock inversion on PageLock and transaction start - quota code needed to first start a transaction and then write the data which subsequently needed acquisition of PageLock while the standard ordering - PageLock first and transaction start later - was used e.g. by pdflush). They implement a new way of quota access to disk: Every filesystem that would like to implement quotas now has to provide quota_read() and quota_write() functions. These functions must obey quota lock ordering (in particular they should not take PageLock inside a transaction). The first patch implements the changes in the quota core, the other three patches implement needed functions in ext2, ext3 and reiserfs. The patch for reiserfs also fixes several other lock inversion problems (similar as ext3 had) and implements the journaled quota functionality (which comes almost for free after the locking fixes...). The quota core patch makes quota support in other filesystems (except XFS which implements everything on its own ;)) unfunctional (quotaon() will refuse to turn on quotas on them). When the patches get reasonable wide testing and it will seem that no major changes will be needed I can make fixes also for the other filesystems (JFS, UDF, UFS). This patch: The patch implements the new way of quota io in the quota core. Every filesystem wanting to support quotas has to provide functions quota_read() and quota_write() obeying quota locking rules. As the writes and reads bypass the pagecache there is some ugly stuff ensuring that userspace can see all the data after quotaoff() (or Q_SYNC quotactl). In future I plan to make quota files inaccessible from userspace (with the exception of quotacheck(8) which will take care about the cache flushing and such stuff itself) so that this synchronization stuff can be removed... The rewrite of the quota core. Quota uses the filesystem read() and write() functions no more to avoid possible deadlocks on PageLock. From now on every filesystem supporting quotas must provide functions quota_read() and quota_write() which obey the quota locking rules (e.g. they cannot acquire the PageLock). Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'security')
-rw-r--r--security/dummy.c2
-rw-r--r--security/selinux/hooks.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/security/dummy.c b/security/dummy.c
index 300722d907985f..3848c26488ed4b 100644
--- a/security/dummy.c
+++ b/security/dummy.c
@@ -92,7 +92,7 @@ static int dummy_quotactl (int cmds, int type, int id, struct super_block *sb)
return 0;
}
-static int dummy_quota_on (struct file *f)
+static int dummy_quota_on (struct dentry *dentry)
{
return 0;
}
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 7f370eb173937d..e0bb5d88d46a1a 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -1494,9 +1494,9 @@ static int selinux_quotactl(int cmds, int type, int id, struct super_block *sb)
return rc;
}
-static int selinux_quota_on(struct file *f)
+static int selinux_quota_on(struct dentry *dentry)
{
- return file_has_perm(current, f, FILE__QUOTAON);
+ return dentry_has_perm(current, NULL, dentry, FILE__QUOTAON);
}
static int selinux_syslog(int type)