From patchwork Tue Jul 31 21:10:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Fasheh X-Patchwork-Id: 10551459 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2EFCD14E0 for ; Tue, 31 Jul 2018 21:11:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 218A52B426 for ; Tue, 31 Jul 2018 21:11:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 200DB2B611; Tue, 31 Jul 2018 21:11:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C1DF92B426 for ; Tue, 31 Jul 2018 21:11:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732269AbeGaWxR (ORCPT ); Tue, 31 Jul 2018 18:53:17 -0400 Received: from mx2.suse.de ([195.135.220.15]:35820 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725886AbeGaWxQ (ORCPT ); Tue, 31 Jul 2018 18:53:16 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 43366ADF7; Tue, 31 Jul 2018 21:11:02 +0000 (UTC) From: Mark Fasheh To: Al Viro , linux-fsdevel@vger.kernel.org Cc: linux-btrfs@vger.kernel.org, Andrew Morton , Amir Goldstein , linux-unionfs@vger.kernel.org, Jeff Mahoney , linux-nfs@vger.kernel.org, Mark Fasheh Subject: [PATCH 2/4] nfs: check for NULL vfsmount in nfs_getattr Date: Tue, 31 Jul 2018 14:10:43 -0700 Message-Id: <20180731211045.5671-3-mfasheh@suse.de> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180731211045.5671-1-mfasheh@suse.de> References: <20180731211045.5671-1-mfasheh@suse.de> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP ->getattr from inside the kernel won't always have a vfsmount, check for this. Signed-off-by: Mark Fasheh --- fs/nfs/inode.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index b65aee481d13..7a3d90a7cc92 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -795,7 +795,9 @@ int nfs_getattr(const struct path *path, struct kstat *stat, } /* - * We may force a getattr if the user cares about atime. + * We may force a getattr if the user cares about atime. A + * NULL vfsmount means we are called from inside the kernel, + * where no atime is required. * * Note that we only have to check the vfsmount flags here: * - NFS always sets S_NOATIME by so checking it would give a @@ -803,7 +805,7 @@ int nfs_getattr(const struct path *path, struct kstat *stat, * - NFS never sets SB_NOATIME or SB_NODIRATIME so there is * no point in checking those. */ - if ((path->mnt->mnt_flags & MNT_NOATIME) || + if (!path->mnt || (path->mnt->mnt_flags & MNT_NOATIME) || ((path->mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode))) request_mask &= ~STATX_ATIME;