From patchwork Thu Jul 1 00:05:22 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Bartell X-Patchwork-Id: 108977 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6104xwJ015912 for ; Thu, 1 Jul 2010 00:05:00 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753101Ab0GAAE6 (ORCPT ); Wed, 30 Jun 2010 20:04:58 -0400 Received: from mail-gw0-f46.google.com ([74.125.83.46]:60425 "EHLO mail-gw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751771Ab0GAAE5 (ORCPT ); Wed, 30 Jun 2010 20:04:57 -0400 Received: by gwb15 with SMTP id 15so769585gwb.19 for ; Wed, 30 Jun 2010 17:04:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:subject :message-id:mail-followup-to:mime-version:content-type :content-disposition:user-agent; bh=znXZ584mvsjlUi/M0FP7qSo+lhhOCP52t8f59/g/mAA=; b=RVgp4+skSQFGM/gC79TfgPABP8bQ6vZJ2VLWoKoI7RMTLB33c8SiDkEteFrfEZD7gH YCEyuoYahQaxlrOHtpjOsC+/AvHj28nUjfOCawd7TmybtvtlMJNAld7OydRL3Y4JdK2O Nf+cL+jxqNHTFkhFhnpR2LqPBjIOFXmuHXFZk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:mail-followup-to:mime-version :content-type:content-disposition:user-agent; b=De0cqcvtJbyr0K4t6Gej1tPNuB1GDhLskd8+rKEICu4KUrJq4owXeUb4f2Rqej63S6 kLq3mBH6RcraLl5eI1h7/Rysza/7jY/A/4NBZrcTiky92u5Yk9e3wwiv7QDQNsRcqd/8 Fzq5I+jVaRDpj5/8JwqTa1a6zMkDHFjXXtjvM= Received: by 10.90.58.24 with SMTP id g24mr7261528aga.83.1277942696433; Wed, 30 Jun 2010 17:04:56 -0700 (PDT) Received: from flcl.lan (cpe-065-190-001-228.nc.res.rr.com [65.190.1.228]) by mx.google.com with ESMTPS id m11sm508758ybn.4.2010.06.30.17.04.55 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 30 Jun 2010 17:04:55 -0700 (PDT) Date: Wed, 30 Jun 2010 20:05:22 -0400 From: Sean Bartell To: linux-btrfs@vger.kernel.org Subject: [PATCH] btrfs: handle errors for FS_IOC_SETFLAGS Message-ID: <20100701000522.GA5456@flcl.lan> Mail-Followup-To: linux-btrfs@vger.kernel.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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 (demeter.kernel.org [140.211.167.41]); Thu, 01 Jul 2010 00:05:00 +0000 (UTC) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 4dbaf89..8db62c2 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -200,19 +200,26 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg) trans = btrfs_join_transaction(root, 1); - BUG_ON(!trans); + if (IS_ERR(trans)) { + ret = PTR_ERR(trans); + goto out_drop_write; + } ret = btrfs_update_inode(trans, root, inode); - BUG_ON(ret); + if (ret) + goto out_endtrans; btrfs_update_iflags(inode); inode->i_ctime = CURRENT_TIME; - btrfs_end_transaction(trans, root); + ret = 0; +out_endtrans: + btrfs_end_transaction(trans, root); +out_drop_write: mnt_drop_write(file->f_path.mnt); - out_unlock: +out_unlock: mutex_unlock(&inode->i_mutex); - return 0; + return ret; } static int btrfs_ioctl_getversion(struct file *file, int __user *arg)