From patchwork Mon Nov 22 18:55:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 348201 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oAMKwFY8003614 for ; Mon, 22 Nov 2010 20:58:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756380Ab0KVTFM (ORCPT ); Mon, 22 Nov 2010 14:05:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:25600 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755940Ab0KVTFJ (ORCPT ); Mon, 22 Nov 2010 14:05:09 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oAMJ59DL012292 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 22 Nov 2010 14:05:09 -0500 Received: from localhost.localdomain (test1244.test.redhat.com [10.10.10.244]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oAMJ59NU000872 for ; Mon, 22 Nov 2010 14:05:09 -0500 From: Josef Bacik To: linux-btrfs@vger.kernel.org Subject: [PATCH] Btrfs: make sure new inode size is ok in fallocate Date: Mon, 22 Nov 2010 13:55:39 -0500 Message-Id: <1290452139-8606-1-git-send-email-josef@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Mon, 22 Nov 2010 20:58:17 +0000 (UTC) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index d83f288..25a8fa2 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -6945,6 +6945,10 @@ static long btrfs_fallocate(struct inode *inode, int mode, btrfs_wait_ordered_range(inode, alloc_start, alloc_end - alloc_start); mutex_lock(&inode->i_mutex); + ret = inode_newsize_ok(inode, alloc_end); + if (ret) + goto out; + if (alloc_start > inode->i_size) { ret = btrfs_cont_expand(inode, alloc_start); if (ret)