Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1269467ybm; Tue, 21 May 2019 11:13:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqxXuyxW0iOiOx6UHDERdvO+CULcwPQNbUDO11YQpMd4jvWX/Q2wbGCJGAaGgLTVZL6EFp2X X-Received: by 2002:aa7:8289:: with SMTP id s9mr88609279pfm.208.1558462438228; Tue, 21 May 2019 11:13:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558462438; cv=none; d=google.com; s=arc-20160816; b=qddSgjbPJl4RINf4c98ZLUOxmTMUurh4XDho6EIQvBVX1Vnn1eCm2JUhPbmgFI8rHa abqH4CXu9ZeHhkDKTfuM4UAGh8nuW/1KLbfxBnNM2NW7SQuRfg0oIqAnz4aBtlhWqlv6 DPI8IGFpp1Zf9GTXjRLUf0SMnQdCN6jqZdaxgaS4lcxyo5O8Lb6HC327700Tv8b4qLLA KiekvqDdzWedHpmZP5a1KnNZ7zGhb5pzyzbIKNC1dIQkhpUCL07b+NyuIEiSzRygEK7e cZvzxlaauFxajtGS4sXHUKAcstBOtBGKXS6SeY+NZz565J51od/9v8u9KhULTcWm6EUp TXYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=1knjho4OacbJBELxw5S4C1tl0wH4IEBJhIRuPuvtFto=; b=NPIPHGg07VTBFq7ZkeJLbxB+lg5zyIxJ23gjKefrXDaEzCYOsVNWSoLP2mApQgvSTu fRy68LDW+cEGvS4pL6U6I6xXqhwgoSvVmog9oBNUeet3WQbt9o+ZrjV0xKkzS1eFnUue ccdrr8Q89DnHdKIi3zM0vTauVd+Dv92cKTKaEkHWnhZenu8+I4AW4ZBbe0wfxWG6fG1e gDn7Oj8XB99kCs2c0bEX9F2Cpno+CvVllD+Zzeyv3FASacv97B5crEHklJgr0qtoYTRX A4AMn1L/qWlZT+l7Ov/ilCCSDl4Vq5750KaaVplTp+AAzu7EqXZ/Ylp04ucFFXRcHrFF tdgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r15si23702128pfq.169.2019.05.21.11.13.42; Tue, 21 May 2019 11:13:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728331AbfEUSNA (ORCPT + 99 others); Tue, 21 May 2019 14:13:00 -0400 Received: from mga01.intel.com ([192.55.52.88]:32849 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728067AbfEUSNA (ORCPT ); Tue, 21 May 2019 14:13:00 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 May 2019 11:12:58 -0700 X-ExtLoop1: 1 Received: from iweiny-desk2.sc.intel.com ([10.3.52.157]) by orsmga005.jf.intel.com with ESMTP; 21 May 2019 11:12:58 -0700 Date: Tue, 21 May 2019 11:13:49 -0700 From: Ira Weiny To: Jan Kara Cc: Ted Tso , linux-ext4@vger.kernel.org Subject: Re: [PATCH 2/3] ext4: Do not delete unlinked inode from orphan list on failed truncate Message-ID: <20190521181348.GB31888@iweiny-DESK2.sc.intel.com> References: <20190521074358.17186-1-jack@suse.cz> <20190521074358.17186-3-jack@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190521074358.17186-3-jack@suse.cz> User-Agent: Mutt/1.11.1 (2018-12-01) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue, May 21, 2019 at 09:43:57AM +0200, Jan Kara wrote: > It is possible that unlinked inode enters ext4_setattr() (e.g. if > somebody calls ftruncate(2) on unlinked but still open file). In such > case we should not delete the inode from the orphan list if truncate > fails. Note that this is mostly a theoretical concern as filesystem is > corrupted if we reach this path anyway but let's be consistent in our > orphan handling. > > Signed-off-by: Jan Kara > --- > fs/ext4/inode.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c > index 9bcb7f2b86dd..c7f77c643008 100644 > --- a/fs/ext4/inode.c > +++ b/fs/ext4/inode.c > @@ -5625,7 +5625,7 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr) > up_write(&EXT4_I(inode)->i_data_sem); > ext4_journal_stop(handle); > if (error) { > - if (orphan) > + if (orphan && inode->i_nlink) > ext4_orphan_del(NULL, inode); NIT: While ext4_orphan_del() can be called even if the inode was not on the orphan list it kind of tripped me up to see this called even if ext4_orphan_add() fails... But considering how ext4_orphan_del() works: Reviewed-by: Ira Weiny > goto err_out; > } > -- > 2.16.4 >