From patchwork Wed Dec 3 18:55:52 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gregkh@suse.de X-Patchwork-Id: 11963 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 19053DDDE6 for ; Thu, 4 Dec 2008 05:59:24 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751459AbYLCS7W (ORCPT ); Wed, 3 Dec 2008 13:59:22 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751908AbYLCS7V (ORCPT ); Wed, 3 Dec 2008 13:59:21 -0500 Received: from kroah.org ([198.145.64.141]:60910 "EHLO coco.kroah.org" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751459AbYLCS7S (ORCPT ); Wed, 3 Dec 2008 13:59:18 -0500 Received: from localhost (mail.kroah.net [66.93.40.174]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by coco.kroah.org (Postfix) with ESMTPSA id 95F8B49044; Wed, 3 Dec 2008 10:59:17 -0800 (PST) Subject: patch ext4-elevate-write-count-for-migrate-ioctl.patch added to 2.6.27-stable tree To: aneesh.kumar@linux.vnet.ibm.com, gregkh@suse.de, linux-ext4@vger.kernel.org, tytso@mit.edu Cc: , From: Date: Wed, 03 Dec 2008 10:55:52 -0800 In-Reply-To: <1226851540-8032-6-git-send-email-tytso@mit.edu> Message-Id: <20081203185917.95F8B49044@coco.kroah.org> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org This is a note to let you know that we have just queued up the patch titled Subject: ext4: elevate write count for migrate ioctl to the 2.6.27-stable tree. Its filename is ext4-elevate-write-count-for-migrate-ioctl.patch A git repo of this tree can be found at http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary From tytso@mit.edu Wed Dec 3 09:58:51 2008 From: Aneesh Kumar K.V Date: Sun, 16 Nov 2008 11:05:25 -0500 Subject: ext4: elevate write count for migrate ioctl To: stable@kernel.org Cc: Ext4 Developers List , "Theodore Ts'o" , "Aneesh Kumar K.V" Message-ID: <1226851540-8032-6-git-send-email-tytso@mit.edu> From: Aneesh Kumar K.V (cherry picked from commit 2a43a878001cc5cb7c3c7be2e8dad0a1aeb939b0) The migrate ioctl writes to the filsystem, so we need to elevate the write count. Signed-off-by: Aneesh Kumar K.V Signed-off-by: "Theodore Ts'o" Signed-off-by: Greg Kroah-Hartman --- fs/ext4/ext4.h | 3 +-- fs/ext4/ioctl.c | 21 ++++++++++++++++++++- fs/ext4/migrate.c | 10 +--------- 3 files changed, 22 insertions(+), 12 deletions(-) Patches currently in stable-queue which might be from aneesh.kumar@linux.vnet.ibm.com are queue-2.6.27/ext4-elevate-write-count-for-migrate-ioctl.patch queue-2.6.27/ext4-free-ext4_prealloc_space-using-kmem_cache_free.patch queue-2.6.27/ext4-do-mballoc-init-before-doing-filesystem-recovery.patch queue-2.6.27/ext4-convert-to-host-order-before-using-the-values.patch queue-2.6.27/ext4-mark-the-buffer_heads-as-dirty-and-uptodate-after-prepare_write.patch -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -1083,8 +1083,7 @@ extern long ext4_ioctl(struct file *, un extern long ext4_compat_ioctl (struct file *, unsigned int, unsigned long); /* migrate.c */ -extern int ext4_ext_migrate(struct inode *, struct file *, unsigned int, - unsigned long); +extern int ext4_ext_migrate(struct inode *); /* namei.c */ extern int ext4_orphan_add(handle_t *, struct inode *); extern int ext4_orphan_del(handle_t *, struct inode *); --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -267,7 +267,26 @@ setversion_out: } case EXT4_IOC_MIGRATE: - return ext4_ext_migrate(inode, filp, cmd, arg); + { + int err; + if (!is_owner_or_cap(inode)) + return -EACCES; + + err = mnt_want_write(filp->f_path.mnt); + if (err) + return err; + /* + * inode_mutex prevent write and truncate on the file. + * Read still goes through. We take i_data_sem in + * ext4_ext_swap_inode_data before we switch the + * inode format to prevent read. + */ + mutex_lock(&(inode->i_mutex)); + err = ext4_ext_migrate(inode); + mutex_unlock(&(inode->i_mutex)); + mnt_drop_write(filp->f_path.mnt); + return err; + } default: return -ENOTTY; --- a/fs/ext4/migrate.c +++ b/fs/ext4/migrate.c @@ -447,8 +447,7 @@ static int free_ext_block(handle_t *hand } -int ext4_ext_migrate(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) +int ext4_ext_migrate(struct inode *inode) { handle_t *handle; int retval = 0, i; @@ -516,12 +515,6 @@ int ext4_ext_migrate(struct inode *inode * when we add extents we extent the journal */ /* - * inode_mutex prevent write and truncate on the file. Read still goes - * through. We take i_data_sem in ext4_ext_swap_inode_data before we - * switch the inode format to prevent read. - */ - mutex_lock(&(inode->i_mutex)); - /* * Even though we take i_mutex we can still cause block allocation * via mmap write to holes. If we have allocated new blocks we fail * migrate. New block allocation will clear EXT4_EXT_MIGRATE flag. @@ -623,7 +616,6 @@ err_out: tmp_inode->i_nlink = 0; ext4_journal_stop(handle); - mutex_unlock(&(inode->i_mutex)); if (tmp_inode) iput(tmp_inode);