From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00591C43444 for ; Thu, 10 Jan 2019 17:05:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C18EF20685 for ; Thu, 10 Jan 2019 17:05:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WPLPgpHA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729222AbfAJRFL (ORCPT ); Thu, 10 Jan 2019 12:05:11 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:51953 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729023AbfAJRFK (ORCPT ); Thu, 10 Jan 2019 12:05:10 -0500 Received: by mail-wm1-f66.google.com with SMTP id b11so11995854wmj.1 for ; Thu, 10 Jan 2019 09:05:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/Z2VSKAn1MvuCP5v3GkIAZfHPLgClZFgO2XoyNw6kcM=; b=WPLPgpHAmlPK0ww9cDSJYuF3Wryi62k/TQ4nI9DlkD4JsWxZlx5b2qIfYCAvs/psx6 GDjScMAXWdexCQbTA+uxTVDLgONOoJ7AG80B7ywP9pmoDRLVFRt/QfpiuR8PoRc2SgG6 liKpE+MJDv18o7/tQ5NM6rRZR6+/gjsadd3w7KaVP4B1O6shYVS+rqoeM7Wqpguuv2bQ vq5uOJN19WROfCLX4NoWb5qpbKd1SGBEM/st/nDKThNhY0bbtBqjGXxQYkg7bv2bsxfx V2LzrPXB1dZ19ugGLaDiQ4P7fDYCg/RgjoKaihEDGHJ/IUySE4v4ZTEuIwrdUZCpO0xh 5ptw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/Z2VSKAn1MvuCP5v3GkIAZfHPLgClZFgO2XoyNw6kcM=; b=Q1wMNVSBgONor3LJT4JCIZ8Ib6yk8pDvi2Y1OhQb9gQkKA62ZXxLtXpL+2yehkgH6O FJ+nkgV80+6FnPiaBDlHFr6fLTHjby/HWWYkc345LQohze9BNv0N9VijtGjRjeZRqW/h QKq07KqOUAblpIFWlLii4x5RopR4CA7OCin+4I7v5hZE2l0KG+cmIk8P4L0GDqnl9p0s 842Yw9SpEe50bjSUoMavxjV4DVa7jBmT87zO5vRMUpdccgR29qlbNF9uX9YD+6vyIg4m ZXSl9OSZ2XqNqvEBE6+XQRJtEqjPkSDY9j9tTIluIoH3SGw0GJ+R7WHIB2uZlM1vw8wS JW6g== X-Gm-Message-State: AJcUukfSBKJgDK537PWCW3q6ZL750i0VVBKJsW2sKTljlVqmaHMWRAP7 htMQ6Sf4YdR5Jw7HHBtV0ZY= X-Google-Smtp-Source: ALg8bN47PafAJJYRZv/cpPfrnPQR6EkSV9N2PwfZi7Ig33AQ60nVBqNgu524xJtz7zxaXPbnv/G4pg== X-Received: by 2002:a1c:b189:: with SMTP id a131mr11057744wmf.38.1547139908350; Thu, 10 Jan 2019 09:05:08 -0800 (PST) Received: from amir-VirtualBox.ctera.local ([188.120.129.201]) by smtp.gmail.com with ESMTPSA id m4sm5725868wmi.3.2019.01.10.09.05.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Jan 2019 09:05:07 -0800 (PST) From: Amir Goldstein To: Jan Kara Cc: Matthew Bobrowski , linux-fsdevel@vger.kernel.org Subject: [PATCH v5 12/17] fanotify: use vfs_get_fsid() helper instead of vfs_statfs() Date: Thu, 10 Jan 2019 19:04:39 +0200 Message-Id: <20190110170444.30616-13-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190110170444.30616-1-amir73il@gmail.com> References: <20190110170444.30616-1-amir73il@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org This is a cleanup that doesn't change any logic. Signed-off-by: Amir Goldstein --- fs/notify/fanotify/fanotify_user.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c index 467e6431fbe9..4254bfedb40b 100644 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c @@ -863,35 +863,31 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags) } /* Check if filesystem can encode a unique fid */ -static int fanotify_test_fid(struct path *path, struct kstatfs *stat) +static int fanotify_test_fid(struct path *path, __kernel_fsid_t *fsid) { - struct kstatfs root_stat; - struct path root = { - .mnt = path->mnt, - .dentry = path->dentry->d_sb->s_root, - }; + __kernel_fsid_t root_fsid; int err; /* * Make sure path is not in filesystem with zero fsid (e.g. tmpfs). */ - err = vfs_statfs(path, stat); + err = vfs_get_fsid(path->dentry, fsid); if (err) return err; - if (!stat->f_fsid.val[0] && !stat->f_fsid.val[1]) + if (!fsid->val[0] && !fsid->val[1]) return -ENODEV; /* * Make sure path is not inside a filesystem subvolume (e.g. btrfs) * which uses a different fsid than sb root. */ - err = vfs_statfs(&root, &root_stat); + err = vfs_get_fsid(path->dentry->d_sb->s_root, &root_fsid); if (err) return err; - if (root_stat.f_fsid.val[0] != stat->f_fsid.val[0] || - root_stat.f_fsid.val[1] != stat->f_fsid.val[1]) + if (root_fsid.val[0] != fsid->val[0] || + root_fsid.val[1] != fsid->val[1]) return -EXDEV; /* @@ -916,8 +912,7 @@ static int do_fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask, struct fsnotify_group *group; struct fd f; struct path path; - struct kstatfs stat; - __kernel_fsid_t *fsid = NULL; + __kernel_fsid_t __fsid, *fsid = NULL; u32 valid_mask = FANOTIFY_EVENTS | FANOTIFY_EVENT_FLAGS; unsigned int mark_type = flags & FANOTIFY_MARK_TYPE_BITS; int ret; @@ -996,11 +991,11 @@ static int do_fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask, goto fput_and_out; if (FAN_GROUP_FLAG(group, FAN_REPORT_FID)) { - ret = fanotify_test_fid(&path, &stat); + ret = fanotify_test_fid(&path, &__fsid); if (ret) goto path_put_and_out; - fsid = &stat.f_fsid; + fsid = &__fsid; } /* inode held in place by reference to path; group by fget on fd */ -- 2.17.1