diff options
| author | Jan Kara <jack@suse.cz> | 2005-01-03 04:12:24 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-01-03 04:12:24 -0800 |
| commit | cf684334cbbc8406337727d3f4be722b4fb49c4b (patch) | |
| tree | 76e4abec85fd7b0873f8b61d4de64f2c2e093e63 /include/linux | |
| parent | 6ffc2881a0afacddc11a8fae357166bb00aafe47 (diff) | |
[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 'include/linux')
| -rw-r--r-- | include/linux/fs.h | 3 | ||||
| -rw-r--r-- | include/linux/quota.h | 2 | ||||
| -rw-r--r-- | include/linux/security.h | 8 |
3 files changed, 8 insertions, 5 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 7bbe6e3838dc..2d369c688cd2 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -992,6 +992,9 @@ struct super_operations { void (*umount_begin) (struct super_block *); int (*show_options)(struct seq_file *, struct vfsmount *); + + ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); + ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); }; /* Inode state bits. Protected by inode_lock. */ diff --git a/include/linux/quota.h b/include/linux/quota.h index f4cbf4636f3e..a279602bbb94 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h @@ -285,7 +285,7 @@ struct quota_info { struct semaphore dqio_sem; /* lock device while I/O in progress */ struct semaphore dqonoff_sem; /* Serialize quotaon & quotaoff */ struct rw_semaphore dqptr_sem; /* serialize ops using quota_info struct, pointers from inode to dquots */ - struct file *files[MAXQUOTAS]; /* fp's to quotafiles */ + struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */ struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */ struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */ }; diff --git a/include/linux/security.h b/include/linux/security.h index 5f56f92e9569..4e0795b5a276 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -1034,7 +1034,7 @@ struct security_operations { int (*sysctl) (struct ctl_table * table, int op); int (*capable) (struct task_struct * tsk, int cap); int (*quotactl) (int cmds, int type, int id, struct super_block * sb); - int (*quota_on) (struct file * f); + int (*quota_on) (struct dentry * dentry); int (*syslog) (int type); int (*settime) (struct timespec *ts, struct timezone *tz); int (*vm_enough_memory) (long pages); @@ -1281,9 +1281,9 @@ static inline int security_quotactl (int cmds, int type, int id, return security_ops->quotactl (cmds, type, id, sb); } -static inline int security_quota_on (struct file * file) +static inline int security_quota_on (struct dentry * dentry) { - return security_ops->quota_on (file); + return security_ops->quota_on (dentry); } static inline int security_syslog(int type) @@ -1959,7 +1959,7 @@ static inline int security_quotactl (int cmds, int type, int id, return 0; } -static inline int security_quota_on (struct file * file) +static inline int security_quota_on (struct dentry * dentry) { return 0; } |
