提交 d5dee5c3 编写于 作者: J Jan Kara 提交者: Linus Torvalds

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: NJan 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: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 a2fe594f
...@@ -12,8 +12,6 @@ ...@@ -12,8 +12,6 @@
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/compat.h> #include <linux/compat.h>
static int reiserfs_unpack(struct inode *inode, struct file *filp);
/* /*
** reiserfs_ioctl - handler for ioctl for inode ** reiserfs_ioctl - handler for ioctl for inode
** supported commands: ** supported commands:
...@@ -159,7 +157,7 @@ int reiserfs_prepare_write(struct file *f, struct page *page, ...@@ -159,7 +157,7 @@ int reiserfs_prepare_write(struct file *f, struct page *page,
** Function try to convert tail from direct item into indirect. ** Function try to convert tail from direct item into indirect.
** It set up nopack attribute in the REISERFS_I(inode)->nopack ** It set up nopack attribute in the REISERFS_I(inode)->nopack
*/ */
static int reiserfs_unpack(struct inode *inode, struct file *filp) int reiserfs_unpack(struct inode *inode, struct file *filp)
{ {
int retval = 0; int retval = 0;
int index; int index;
......
...@@ -2025,6 +2025,7 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, ...@@ -2025,6 +2025,7 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
{ {
int err; int err;
struct nameidata nd; struct nameidata nd;
struct inode *inode;
if (!(REISERFS_SB(sb)->s_mount_opt & (1 << REISERFS_QUOTA))) if (!(REISERFS_SB(sb)->s_mount_opt & (1 << REISERFS_QUOTA)))
return -EINVAL; return -EINVAL;
...@@ -2039,13 +2040,19 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, ...@@ -2039,13 +2040,19 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
path_put(&nd.path); path_put(&nd.path);
return -EXDEV; return -EXDEV;
} }
inode = nd.path.dentry->d_inode;
/* We must not pack tails for quota files on reiserfs for quota IO to work */ /* We must not pack tails for quota files on reiserfs for quota IO to work */
if (!(REISERFS_I(nd.path.dentry->d_inode)->i_flags & i_nopack_mask)) { if (!(REISERFS_I(inode)->i_flags & i_nopack_mask)) {
err = reiserfs_unpack(inode, NULL);
if (err) {
reiserfs_warning(sb, reiserfs_warning(sb,
"reiserfs: Quota file must have tail packing disabled."); "reiserfs: Unpacking tail of quota file failed"
" (%d). Cannot turn on quotas.", err);
path_put(&nd.path); path_put(&nd.path);
return -EINVAL; return -EINVAL;
} }
mark_inode_dirty(inode);
}
/* Not journalling quota? No more tests needed... */ /* Not journalling quota? No more tests needed... */
if (!REISERFS_SB(sb)->s_qf_names[USRQUOTA] && if (!REISERFS_SB(sb)->s_qf_names[USRQUOTA] &&
!REISERFS_SB(sb)->s_qf_names[GRPQUOTA]) { !REISERFS_SB(sb)->s_qf_names[GRPQUOTA]) {
......
...@@ -2176,6 +2176,7 @@ int reiserfs_ioctl(struct inode *inode, struct file *filp, ...@@ -2176,6 +2176,7 @@ int reiserfs_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg); unsigned int cmd, unsigned long arg);
long reiserfs_compat_ioctl(struct file *filp, long reiserfs_compat_ioctl(struct file *filp,
unsigned int cmd, unsigned long arg); unsigned int cmd, unsigned long arg);
int reiserfs_unpack(struct inode *inode, struct file *filp);
/* ioctl's command */ /* ioctl's command */
#define REISERFS_IOC_UNPACK _IOW(0xCD,1,long) #define REISERFS_IOC_UNPACK _IOW(0xCD,1,long)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册