diff options
author | Jan Kara <jack@suse.cz> | 2010-09-15 11:38:58 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2011-01-12 13:14:55 -0500 |
commit | f00c9e44ad1a9660fe8cd3ca15b6cd9497172eab (patch) | |
tree | cbb47ae0d8aba9d8b3c44714b000156715cdf969 /include | |
parent | 4162cf64973df51fc885825bc9ca4d055891c49f (diff) |
quota: Fix deadlock during path resolution
As Al Viro pointed out path resolution during Q_QUOTAON calls to quotactl
is prone to deadlocks. We hold s_umount semaphore for reading during the
path resolution and resolution itself may need to acquire the semaphore
for writing when e. g. autofs mountpoint is passed.
Solve the problem by performing the resolution before we get hold of the
superblock (and thus s_umount semaphore). The whole thing is complicated
by the fact that some filesystems (OCFS2) ignore the path argument. So to
distinguish between filesystem which want the path and which do not we
introduce new .quota_on_meta callback which does not get the path. OCFS2
then uses this callback instead of old .quota_on.
CC: Al Viro <viro@ZenIV.linux.org.uk>
CC: Christoph Hellwig <hch@lst.de>
CC: Ted Ts'o <tytso@mit.edu>
CC: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/quota.h | 5 | ||||
-rw-r--r-- | include/linux/quotaops.h | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/include/linux/quota.h b/include/linux/quota.h index 94c1f03b50eb..9a85412e0db6 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h | |||
@@ -322,9 +322,12 @@ struct dquot_operations { | |||
322 | qsize_t *(*get_reserved_space) (struct inode *); | 322 | qsize_t *(*get_reserved_space) (struct inode *); |
323 | }; | 323 | }; |
324 | 324 | ||
325 | struct path; | ||
326 | |||
325 | /* Operations handling requests from userspace */ | 327 | /* Operations handling requests from userspace */ |
326 | struct quotactl_ops { | 328 | struct quotactl_ops { |
327 | int (*quota_on)(struct super_block *, int, int, char *); | 329 | int (*quota_on)(struct super_block *, int, int, struct path *); |
330 | int (*quota_on_meta)(struct super_block *, int, int); | ||
328 | int (*quota_off)(struct super_block *, int); | 331 | int (*quota_off)(struct super_block *, int); |
329 | int (*quota_sync)(struct super_block *, int, int); | 332 | int (*quota_sync)(struct super_block *, int, int); |
330 | int (*get_info)(struct super_block *, int, struct if_dqinfo *); | 333 | int (*get_info)(struct super_block *, int, struct if_dqinfo *); |
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index 223b14cd129c..eb354f6f26b3 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h | |||
@@ -76,11 +76,9 @@ int dquot_mark_dquot_dirty(struct dquot *dquot); | |||
76 | 76 | ||
77 | int dquot_file_open(struct inode *inode, struct file *file); | 77 | int dquot_file_open(struct inode *inode, struct file *file); |
78 | 78 | ||
79 | int dquot_quota_on(struct super_block *sb, int type, int format_id, | ||
80 | char *path); | ||
81 | int dquot_enable(struct inode *inode, int type, int format_id, | 79 | int dquot_enable(struct inode *inode, int type, int format_id, |
82 | unsigned int flags); | 80 | unsigned int flags); |
83 | int dquot_quota_on_path(struct super_block *sb, int type, int format_id, | 81 | int dquot_quota_on(struct super_block *sb, int type, int format_id, |
84 | struct path *path); | 82 | struct path *path); |
85 | int dquot_quota_on_mount(struct super_block *sb, char *qf_name, | 83 | int dquot_quota_on_mount(struct super_block *sb, char *qf_name, |
86 | int format_id, int type); | 84 | int format_id, int type); |