diff options
author | Jan Kara <jack@suse.cz> | 2008-04-28 05:16:23 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-28 11:58:46 -0400 |
commit | d5dee5c395062a55236318ac4eec1f4ebb9de6db (patch) | |
tree | 2481afd9fbdd1df106d71a41cce2b08380f21d44 | |
parent | a2fe594fa3732298947377409b5d8111b14f56ec (diff) |
reiserfs: unpack tails on quota files
Quota files cannot have tails because quota_write and quota_read functions do
not support them. So far when quota files did have tail, we just refused to
turn quotas on it. Sadly this check has been wrong and so there are now
plenty installations where quota files don't have NOTAIL flag set and so now
after fixing the check, they suddently fail to turn quotas on. Since it's
easy to unpack the tail from kernel, do this from reiserfs_quota_on() which
solves the problem and is generally nicer to users anyway.
Signed-off-by: Jan Kara <jack@suse.cz>
Reported-by: <urhausen@urifabi.net>
Cc: Jeff Mahoney <jeffm@suse.com>
Cc: Chris Mason <chris.mason@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/reiserfs/ioctl.c | 4 | ||||
-rw-r--r-- | fs/reiserfs/super.c | 17 | ||||
-rw-r--r-- | include/linux/reiserfs_fs.h | 1 |
3 files changed, 14 insertions, 8 deletions
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c index 74363a7aacbc..830332021ed4 100644 --- a/fs/reiserfs/ioctl.c +++ b/fs/reiserfs/ioctl.c | |||
@@ -12,8 +12,6 @@ | |||
12 | #include <linux/smp_lock.h> | 12 | #include <linux/smp_lock.h> |
13 | #include <linux/compat.h> | 13 | #include <linux/compat.h> |
14 | 14 | ||
15 | static int reiserfs_unpack(struct inode *inode, struct file *filp); | ||
16 | |||
17 | /* | 15 | /* |
18 | ** reiserfs_ioctl - handler for ioctl for inode | 16 | ** reiserfs_ioctl - handler for ioctl for inode |
19 | ** supported commands: | 17 | ** supported commands: |
@@ -159,7 +157,7 @@ int reiserfs_prepare_write(struct file *f, struct page *page, | |||
159 | ** Function try to convert tail from direct item into indirect. | 157 | ** Function try to convert tail from direct item into indirect. |
160 | ** It set up nopack attribute in the REISERFS_I(inode)->nopack | 158 | ** It set up nopack attribute in the REISERFS_I(inode)->nopack |
161 | */ | 159 | */ |
162 | static int reiserfs_unpack(struct inode *inode, struct file *filp) | 160 | int reiserfs_unpack(struct inode *inode, struct file *filp) |
163 | { | 161 | { |
164 | int retval = 0; | 162 | int retval = 0; |
165 | int index; | 163 | int index; |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index a4c9770a6012..ed424d708e69 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -2025,6 +2025,7 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, | |||
2025 | { | 2025 | { |
2026 | int err; | 2026 | int err; |
2027 | struct nameidata nd; | 2027 | struct nameidata nd; |
2028 | struct inode *inode; | ||
2028 | 2029 | ||
2029 | if (!(REISERFS_SB(sb)->s_mount_opt & (1 << REISERFS_QUOTA))) | 2030 | if (!(REISERFS_SB(sb)->s_mount_opt & (1 << REISERFS_QUOTA))) |
2030 | return -EINVAL; | 2031 | return -EINVAL; |
@@ -2039,12 +2040,18 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, | |||
2039 | path_put(&nd.path); | 2040 | path_put(&nd.path); |
2040 | return -EXDEV; | 2041 | return -EXDEV; |
2041 | } | 2042 | } |
2043 | inode = nd.path.dentry->d_inode; | ||
2042 | /* We must not pack tails for quota files on reiserfs for quota IO to work */ | 2044 | /* We must not pack tails for quota files on reiserfs for quota IO to work */ |
2043 | if (!(REISERFS_I(nd.path.dentry->d_inode)->i_flags & i_nopack_mask)) { | 2045 | if (!(REISERFS_I(inode)->i_flags & i_nopack_mask)) { |
2044 | reiserfs_warning(sb, | 2046 | err = reiserfs_unpack(inode, NULL); |
2045 | "reiserfs: Quota file must have tail packing disabled."); | 2047 | if (err) { |
2046 | path_put(&nd.path); | 2048 | reiserfs_warning(sb, |
2047 | return -EINVAL; | 2049 | "reiserfs: Unpacking tail of quota file failed" |
2050 | " (%d). Cannot turn on quotas.", err); | ||
2051 | path_put(&nd.path); | ||
2052 | return -EINVAL; | ||
2053 | } | ||
2054 | mark_inode_dirty(inode); | ||
2048 | } | 2055 | } |
2049 | /* Not journalling quota? No more tests needed... */ | 2056 | /* Not journalling quota? No more tests needed... */ |
2050 | if (!REISERFS_SB(sb)->s_qf_names[USRQUOTA] && | 2057 | if (!REISERFS_SB(sb)->s_qf_names[USRQUOTA] && |
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index 8e7eff2cd0ab..4aacaeecb56f 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h | |||
@@ -2176,6 +2176,7 @@ int reiserfs_ioctl(struct inode *inode, struct file *filp, | |||
2176 | unsigned int cmd, unsigned long arg); | 2176 | unsigned int cmd, unsigned long arg); |
2177 | long reiserfs_compat_ioctl(struct file *filp, | 2177 | long reiserfs_compat_ioctl(struct file *filp, |
2178 | unsigned int cmd, unsigned long arg); | 2178 | unsigned int cmd, unsigned long arg); |
2179 | int reiserfs_unpack(struct inode *inode, struct file *filp); | ||
2179 | 2180 | ||
2180 | /* ioctl's command */ | 2181 | /* ioctl's command */ |
2181 | #define REISERFS_IOC_UNPACK _IOW(0xCD,1,long) | 2182 | #define REISERFS_IOC_UNPACK _IOW(0xCD,1,long) |