public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: Justin Forbes <jmforbes@linuxtx.org>,
	Zwane Mwaikambo <zwane@arm.linux.org.uk>,
	"Theodore Ts'o" <tytso@mit.edu>,
	Randy Dunlap <rdunlap@xenotime.net>,
	Dave Jones <davej@redhat.com>,
	Chuck Wolber <chuckw@quantumlinux.com>,
	Chris Wedgwood <reviews@ml.cw.f00f.org>,
	Michael Krufky <mkrufky@linuxtv.org>,
	Chuck Ebbert <cebbert@redhat.com>,
	Domenico Andreoli <cavokz@gmail.com>,
	torvalds@linux-foundation.org, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk, Jan Kara <jack@suse.cz>,
	Jeff Mahoney <jeffm@suse.com>,
	Chris Mason <chris.mason@oracle.com>
Subject: [patch 06/16] reiserfs: Unpack tails on quota files
Date: Thu, 8 May 2008 10:42:09 -0700	[thread overview]
Message-ID: <20080508174209.GG855@suse.de> (raw)
In-Reply-To: <20080508174122.GA855@suse.de>

[-- Attachment #1: reiserfs-unpack-tails-on-quota-files.patch --]
[-- Type: text/plain, Size: 3351 bytes --]

2.6.25-stable review patch.  If anyone has any objections, please let us
know.

------------------
From: Jan Kara <jack@suse.cz>

commit d5dee5c395062a55236318ac4eec1f4ebb9de6db upstream

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 fs/reiserfs/ioctl.c         |    4 +---
 fs/reiserfs/super.c         |   17 ++++++++++++-----
 include/linux/reiserfs_fs.h |    1 +
 3 files changed, 14 insertions(+), 8 deletions(-)

--- a/fs/reiserfs/ioctl.c
+++ b/fs/reiserfs/ioctl.c
@@ -11,8 +11,6 @@
 #include <linux/smp_lock.h>
 #include <linux/compat.h>
 
-static int reiserfs_unpack(struct inode *inode, struct file *filp);
-
 /*
 ** reiserfs_ioctl - handler for ioctl for inode
 ** supported commands:
@@ -140,7 +138,7 @@ int reiserfs_prepare_write(struct file *
 ** Function try to convert tail from direct item into indirect.
 ** 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 index;
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -2019,6 +2019,7 @@ static int reiserfs_quota_on(struct supe
 {
 	int err;
 	struct nameidata nd;
+	struct inode *inode;
 
 	if (!(REISERFS_SB(sb)->s_mount_opt & (1 << REISERFS_QUOTA)))
 		return -EINVAL;
@@ -2030,12 +2031,18 @@ static int reiserfs_quota_on(struct supe
 		path_put(&nd.path);
 		return -EXDEV;
 	}
+	inode = nd.path.dentry->d_inode;
 	/* 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)) {
-		reiserfs_warning(sb,
-				 "reiserfs: Quota file must have tail packing disabled.");
-		path_put(&nd.path);
-		return -EINVAL;
+	if (!(REISERFS_I(inode)->i_flags & i_nopack_mask)) {
+		err = reiserfs_unpack(inode, NULL);
+		if (err) {
+			reiserfs_warning(sb,
+				"reiserfs: Unpacking tail of quota file failed"
+				" (%d). Cannot turn on quotas.", err);
+			path_put(&nd.path);
+			return -EINVAL;
+		}
+		mark_inode_dirty(inode);
 	}
 	/* Not journalling quota? No more tests needed... */
 	if (!REISERFS_SB(sb)->s_qf_names[USRQUOTA] &&
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -2176,6 +2176,7 @@ int reiserfs_ioctl(struct inode *inode, 
 		   unsigned int cmd, unsigned long arg);
 long reiserfs_compat_ioctl(struct file *filp,
 		   unsigned int cmd, unsigned long arg);
+int reiserfs_unpack(struct inode *inode, struct file *filp);
 
 /* ioctl's command */
 #define REISERFS_IOC_UNPACK		_IOW(0xCD,1,long)

-- 

  parent reply	other threads:[~2008-05-08 17:46 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080508173436.454278564@mini.kroah.org>
2008-05-08 17:41 ` [patch 00/16] Linux 2.6.25 -stable review Greg KH
2008-05-08 17:41   ` [patch 01/16] 2.6.25 regression: powertop says 120K wakeups/sec Greg KH
2008-05-08 17:41   ` [patch 02/16] mm: fix usemap initialization Greg KH
2008-05-08 17:42   ` [patch 03/16] md: fix use after free when removing rdev via sysfs Greg KH
2008-05-08 17:42   ` [patch 04/16] vfs: fix permission checking in sys_utimensat Greg KH
2008-05-08 17:42   ` [patch 05/16] sched: fix hrtick_start_fair and CPU-Hotplug Greg KH
2008-05-08 17:42   ` Greg KH [this message]
2008-05-08 17:42   ` [patch 07/16] POWERPC: mpc5200: Fix unterminated of_device_id table Greg KH
2008-05-08 17:42   ` [patch 08/16] b43: Fix dual-PHY devices Greg KH
2008-05-08 19:38     ` John W. Linville
2008-05-08 17:42   ` [patch 09/16] kprobes/arm: fix cache flush address for instruction stub Greg KH
2008-05-08 17:42   ` [patch 10/16] kprobes/arm: fix decoding of arithmetic immediate instructions Greg KH
2008-05-08 17:42   ` [patch 11/16] b43: Fix some TX/RX locking issues Greg KH
2008-05-08 20:04     ` John W. Linville
2008-05-08 17:42   ` [patch 12/16] x86 PCI: call dmi_check_pciprobe() Greg KH
2008-05-08 17:42   ` [patch 13/16] CRYPTO: api: Fix scatterwalk_sg_chain Greg KH
2008-05-08 17:42   ` [patch 14/16] CRYPTO: cryptd: Correct kzalloc error test Greg KH
2008-05-08 17:42   ` [patch 15/16] CRYPTO: authenc: Fix async crypto crash in crypto_authenc_genicv() Greg KH
2008-05-08 17:42   ` [patch 16/16] CRYPTO: eseqiv: Fix off-by-one encryption Greg KH
2008-05-08 17:51   ` [patch 00/16] Linux 2.6.25 -stable review Willy Tarreau
2008-05-08 18:20     ` Greg KH
2008-05-08 18:25     ` Greg KH
2008-05-08 18:13   ` Willy Tarreau
2008-05-08 18:22     ` Greg KH
2008-05-08 18:33       ` Willy Tarreau
2008-05-08 19:16         ` Len Brown
2008-05-08 19:43           ` Greg KH
2008-05-09  0:51             ` Li Zefan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080508174209.GG855@suse.de \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=cavokz@gmail.com \
    --cc=cebbert@redhat.com \
    --cc=chris.mason@oracle.com \
    --cc=chuckw@quantumlinux.com \
    --cc=davej@redhat.com \
    --cc=jack@suse.cz \
    --cc=jeffm@suse.com \
    --cc=jmforbes@linuxtx.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkrufky@linuxtv.org \
    --cc=rdunlap@xenotime.net \
    --cc=reviews@ml.cw.f00f.org \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    --cc=zwane@arm.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox