Received: by 10.223.185.116 with SMTP id b49csp2193517wrg; Thu, 15 Feb 2018 07:55:31 -0800 (PST) X-Google-Smtp-Source: AH8x2252tND0g4gLwwENDV+K0oSyBemaoLiBJqKwdTCu3OVRhkh4pL9EAlL7MbMFGe8Mlk5B5yz4 X-Received: by 10.98.66.216 with SMTP id h85mr3043192pfd.235.1518710131563; Thu, 15 Feb 2018 07:55:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518710131; cv=none; d=google.com; s=arc-20160816; b=URBZhPtk5bGADoGm/sNuI3FhGgHbfr3DjSBFwlHvJh8yoT8cg8dmSncGTjA1ZoZxMm IIBbYtL8EN97iVFlK9F2IX7JYOqxCtUtvramBUWPtqL23dyW3iKqnzPQUhdLHSieM9z/ fGQWQFjhA4FFosFSaVuBBdUMnpa/hjwHtko1Lq4VK6FfFKzhPoKgd+IEFFz0JLjUgaca 8upXAGR+/29vAUeBFy0uFKdznso4o61FeE8QNsxJoYOwWi7KnJzKi2hRD9Et1q1IH3m7 xYTMTM10lE90RL1kml9ZUHDtiwsm9R9JvJ8IHkj4vnzPPUMqSM+rfEn55z1s1VK8DUWL 52qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=b601dGxZFcQ5HgYuBl0doYTGzmBH3c2V+eourw++yjQ=; b=B0zmATilGX19dt24ikee6nuWLctMEPPdWDw1NAiC2hAt9RgXFN8E7GTw+kgOIp6OaB FLnfrTl7WNr4nGNDnRMSuVpmltspQ+zHizIhsex/46E+WpYkT/M/KpnYOf0Z2qPB18Yc 5yJ9wzroiGKgTosKIaD+DikOq3mH9Vwy0Cxwm5COHkHtkkKDmFSdXcTNEjS2ipyvDIk5 O5Mfvax5sNRSsvd0UdtyVTE8tkxitDvtyJBh327OtJ5hdpaeJXcSfGSD0Jk42YF8kPHB mjW3eecZK2Jc/eF/f2QLKCMhR+qstvlMgLjlKJm+4OHykyI2YzK/mjOyUr5T7iDP4/pL qKRQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a7si186749pgc.452.2018.02.15.07.55.16; Thu, 15 Feb 2018 07:55:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1425167AbeBOPyP (ORCPT + 99 others); Thu, 15 Feb 2018 10:54:15 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:36292 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424926AbeBOPrg (ORCPT ); Thu, 15 Feb 2018 10:47:36 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 3095B1025; Thu, 15 Feb 2018 15:47:36 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Amir Goldstein , Miklos Szeredi Subject: [PATCH 4.15 195/202] ovl: take mnt_want_write() for removing impure xattr Date: Thu, 15 Feb 2018 16:18:15 +0100 Message-Id: <20180215151722.886256529@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151712.768794354@linuxfoundation.org> References: <20180215151712.768794354@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Amir Goldstein commit a5a927a7c82e28ea76599dee4019c41e372c911f upstream. The optimization in ovl_cache_get_impure() that tries to remove an unneeded "impure" xattr needs to take mnt_want_write() on upper fs. Fixes: 4edb83bb1041 ("ovl: constant d_ino for non-merge dirs") Signed-off-by: Amir Goldstein Signed-off-by: Miklos Szeredi Signed-off-by: Greg Kroah-Hartman --- fs/overlayfs/readdir.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) --- a/fs/overlayfs/readdir.c +++ b/fs/overlayfs/readdir.c @@ -593,8 +593,15 @@ static struct ovl_dir_cache *ovl_cache_g return ERR_PTR(res); } if (list_empty(&cache->entries)) { - /* Good oportunity to get rid of an unnecessary "impure" flag */ - ovl_do_removexattr(ovl_dentry_upper(dentry), OVL_XATTR_IMPURE); + /* + * A good opportunity to get rid of an unneeded "impure" flag. + * Removing the "impure" xattr is best effort. + */ + if (!ovl_want_write(dentry)) { + ovl_do_removexattr(ovl_dentry_upper(dentry), + OVL_XATTR_IMPURE); + ovl_drop_write(dentry); + } ovl_clear_flag(OVL_IMPURE, d_inode(dentry)); kfree(cache); return NULL;