Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1211523imm; Fri, 8 Jun 2018 11:56:06 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJZoq3qNktTCmXRoaZCJBCPu8/zQu1uONQXhF4LPRPhv+xl7jEw9Bx82bDVPntmdYJRGfnv X-Received: by 2002:a62:84e:: with SMTP id c75-v6mr7252408pfd.35.1528484166145; Fri, 08 Jun 2018 11:56:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528484166; cv=none; d=google.com; s=arc-20160816; b=dNahS0eRRPxXzHuX30m+HNp1FV75anSxjcr8uvN7tKEfAeo0EY+L9Vr6svKlJ/WO2O cTC+JNuJ1OzVlsERuBGvKoYCCwrvlf3wjODZRtjC2HYudRiNMiHcN35kzI8Awq/4gCEw 1hmHh2+BFFbSI8o54Cs1ayuf8b1trg0oQ9IcL+JXZ0KN7NByvwbXOk5f5Otv+GYOaxUe 4r6pVAjI6Bb5D1Me1ol/IEoBWepbMKgD5qUk1oqvMznRzo8r6aCUSCT+rdMcnrs7npsb CXHYzM2aEZTeB6Aqw7SQ+K8QD4KIqlnq9RD64v+cbRmfUq/P89FVAM8FZjb6S16qLxVE B0Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=2Q9nH4yTPAk2GP5G049H+DRIXSpaclCWqpQ+zxYNyG4=; b=qIeR64xcf5k2P3uVY+xH12m1dPBTG98cSNFuEmcR0zyGmflNMcdHggE8/jqFJpR3Ps E//eXcXob5PijSv992elkMH1x5eAEuhlj+nl0aHFcT7CcGdURTAEPeB2eBZ4UG6n5ysd WPh7TN59/D0yY5oas1AwltH9shDlo+SJ1v1uYkUbrEpWCp+d6AYqUUWX4LT+lMmMjyQF mf8pqdyy8nulGYrfyTVc000GUYs+mC0hXE1cWMT5Np9VYSAZOtFzcNfJg212/bYaNxAb 10WmS86WQVeAR4RAZLRmH45xdr1Zz4rGve/KAPhzsXeN+SC7VX68Hg4dN1whPjSxHQV7 ZaxA== 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 z190-v6si45505885pgb.108.2018.06.08.11.55.51; Fri, 08 Jun 2018 11:56:06 -0700 (PDT) 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 S1753156AbeFHSxO (ORCPT + 99 others); Fri, 8 Jun 2018 14:53:14 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:53800 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752708AbeFHSuV (ORCPT ); Fri, 8 Jun 2018 14:50:21 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.87 #1 (Red Hat Linux)) id 1fRMSp-0006Nn-W2; Fri, 08 Jun 2018 18:50:20 +0000 From: Al Viro To: Linus Torvalds Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/13] switch all remaining checks for FILE_OPENED to FMODE_OPENED Date: Fri, 8 Jun 2018 19:50:12 +0100 Message-Id: <20180608185019.24472-6-viro@ZenIV.linux.org.uk> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180608185019.24472-1-viro@ZenIV.linux.org.uk> References: <20180608184842.GD30522@ZenIV.linux.org.uk> <20180608185019.24472-1-viro@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro Signed-off-by: Al Viro --- fs/namei.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 2abd00079b26..3034c97df757 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3027,8 +3027,6 @@ static int atomic_open(struct nameidata *nd, struct dentry *dentry, * permission here. */ int acc_mode = op->acc_mode; - if (file->f_mode & FMODE_OPENED) - *opened |= FILE_OPENED; if (*opened & FILE_CREATED) { WARN_ON(!(open_flag & O_CREAT)); fsnotify_create(dir, dentry); @@ -3363,11 +3361,10 @@ static int do_last(struct nameidata *nd, error = may_open(&nd->path, acc_mode, open_flag); if (error) goto out; - BUG_ON(*opened & FILE_OPENED); /* once it's opened, it's opened */ + BUG_ON(file->f_mode & FMODE_OPENED); /* once it's opened, it's opened */ error = vfs_open(&nd->path, file, current_cred()); if (error) goto out; - *opened |= FILE_OPENED; opened: error = open_check_o_direct(file); if (!error) @@ -3449,8 +3446,6 @@ static int do_tmpfile(struct nameidata *nd, unsigned flags, error = finish_open(file, child, NULL); if (error) goto out2; - if (file->f_mode & FMODE_OPENED) - *opened |= FILE_OPENED; error = open_check_o_direct(file); out2: mnt_drop_write(path.mnt); @@ -3492,8 +3487,6 @@ static struct file *path_openat(struct nameidata *nd, if (unlikely(file->f_flags & O_PATH)) { error = do_o_path(nd, flags, file); - if (!error) - opened |= FILE_OPENED; goto out2; } @@ -3514,12 +3507,12 @@ static struct file *path_openat(struct nameidata *nd, terminate_walk(nd); out2: if (likely(!error)) { - if (likely(opened & FILE_OPENED)) + if (likely(file->f_mode & FMODE_OPENED)) return file; WARN_ON(1); error = -EINVAL; } - if (opened & FILE_OPENED) + if (file->f_mode & FMODE_OPENED) fput(file); else put_filp(file); -- 2.11.0