From patchwork Thu May 16 10:26:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10946271 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 8194E924 for ; Thu, 16 May 2019 10:26:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71D46288F8 for ; Thu, 16 May 2019 10:26:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6619B28978; Thu, 16 May 2019 10:26:58 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 5835528971 for ; Thu, 16 May 2019 10:26:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726778AbfEPK04 (ORCPT ); Thu, 16 May 2019 06:26:56 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:39048 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726569AbfEPK04 (ORCPT ); Thu, 16 May 2019 06:26:56 -0400 Received: by mail-wm1-f67.google.com with SMTP id n25so2525532wmk.4 for ; Thu, 16 May 2019 03:26:55 -0700 (PDT) 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=6OuFsnHiV6x010Ff4QUoBuXDtH16aIZ/7pT/eI266KQ=; b=BGsCJWmN1XkPwTN0Cu7Av0zoNp0CZhAgevGKgpGpdOM9qBZXWRicnAEQvUgGwi2Qjo A2pvzoNWStXccMqYio95ABa3VHIzb5KtUbyNfqeAY5K/O1YO9FyKLrHfHW5lpZWkCD/E R4cP02gPPaIhe7+CAp7D0ckarYaMY1Gg0x52MnaPljOem6J8gE2xItGRg46IM7mwBdxe vz4WPUfJfKRU0rnlqLlbX2yQlPAJ1xSR1wQGiI/gZCi/mbc/fIrLheo/JkB5E0qu4qgO dGf9mZO7gTP1XTQO3l3GLkGWaozpn9YqDlvRlT546TbNNwCw39Ai7j1lPVk4Xh9dnII4 686A== 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=6OuFsnHiV6x010Ff4QUoBuXDtH16aIZ/7pT/eI266KQ=; b=YnHEqnWevkRm3fhvMUXyzQueZdj1OIQMf4+oCQMDP1Pgj8cLn8+QEBqI9mj5Hmwy9Z RFVKATVIiK8WTZgpzbzZWQXm651NG3R8Poj+6ScKRuXcXjtxUC89ZWt2PGexQHIM2d3G Pdt1YTJ55DuCYDBbAzgEBZGCYhPMYS8kTm3SwZuibtR/jL8IbnPY4P6wyc9cuL8keb78 jKfhoJsbBWipEXoNXxk/QVRzquyjT654H77EKTlmsWllEIpfgWvnPGRBskC4VvRROtwg oYDuvwtvC7QugHFEfWdtiiHkJxB8IorG+mx0cUyiXVgIKWFoRORzBXkOnaahTDJl6uYN Y5Lw== X-Gm-Message-State: APjAAAW8OnyMi4j9Kbno3RRR2/zWcGcYU3hLTD1qcMfkqHm68LYf8YtB 81Y13YeH85a1W6ONLFSbPOU= X-Google-Smtp-Source: APXvYqzJIvUoBbyxAV+kJ9o7pD0WJv8KYMZxxhCYLZcavXm+TmJ3VgBQaEMv43sGmwo0rgJ0OBZphg== X-Received: by 2002:a1c:b782:: with SMTP id h124mr28071419wmf.5.1558002414789; Thu, 16 May 2019 03:26:54 -0700 (PDT) Received: from amir-ThinkPad-T480.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id d72sm4506299wmd.12.2019.05.16.03.26.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 May 2019 03:26:54 -0700 (PDT) From: Amir Goldstein To: Jan Kara Cc: Matthew Bobrowski , linux-fsdevel@vger.kernel.org, Kuninori Morimoto , Mark Brown Subject: [PATCH v2 01/14] ASoC: rename functions that pollute the simple_xxx namespace Date: Thu, 16 May 2019 13:26:28 +0300 Message-Id: <20190516102641.6574-2-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190516102641.6574-1-amir73il@gmail.com> References: <20190516102641.6574-1-amir73il@gmail.com> 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 include/linux/fs.h defines a bunch of simple fs helpers, (e.g. simple_rename) and we intend to add an fs helper named simple_remove. Rename the ASoC driver static functions, so they will not collide with the upcoming fs helper function name. Cc: Kuninori Morimoto Cc: Mark Brown Signed-off-by: Amir Goldstein Acked-by: Kuninori Morimoto --- sound/soc/generic/simple-card.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 9b568f578bcd..d16e894fce2b 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -607,7 +607,7 @@ static int simple_soc_probe(struct snd_soc_card *card) return 0; } -static int simple_probe(struct platform_device *pdev) +static int asoc_simple_probe(struct platform_device *pdev) { struct asoc_simple_priv *priv; struct device *dev = &pdev->dev; @@ -705,7 +705,7 @@ static int simple_probe(struct platform_device *pdev) return ret; } -static int simple_remove(struct platform_device *pdev) +static int asoc_simple_remove(struct platform_device *pdev) { struct snd_soc_card *card = platform_get_drvdata(pdev); @@ -726,8 +726,8 @@ static struct platform_driver asoc_simple_card = { .pm = &snd_soc_pm_ops, .of_match_table = simple_of_match, }, - .probe = simple_probe, - .remove = simple_remove, + .probe = asoc_simple_probe, + .remove = asoc_simple_remove, }; module_platform_driver(asoc_simple_card); From patchwork Thu May 16 10:26:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10946273 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 EA7BF1515 for ; Thu, 16 May 2019 10:26:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DAD36288F8 for ; Thu, 16 May 2019 10:26:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF0A728971; Thu, 16 May 2019 10:26:58 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 752C228A39 for ; Thu, 16 May 2019 10:26:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726787AbfEPK05 (ORCPT ); Thu, 16 May 2019 06:26:57 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:33025 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726336AbfEPK05 (ORCPT ); Thu, 16 May 2019 06:26:57 -0400 Received: by mail-wm1-f67.google.com with SMTP id c66so6699958wme.0 for ; Thu, 16 May 2019 03:26:56 -0700 (PDT) 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=IxwvaE0YmGct/RzoWtDeDc7kHgzj0Gomy2LP+TO3SVY=; b=K66JSEner4SPN49fhAhSA0F92yi6umMSYYuOv/1vpUuA0N8kr4hieGSIwQKQhGdj2U eNAUBdaUb1Xx5VH/IjYxtTwIp3zuU1Y9m/gRMQoDeF6igUX9wyInY63hiw2cu5XuMVGz /zrfgFjJxcE4mNc7CeauAEroFULEhl8E4e/HibDRnG6stF6FbTrLpeCGQmU8FObjgf2+ F774+qKL77hE6klmQaTuXRUSdcbV1yaL0uF391CLOyc2GGg4AiTnob81ZyMkXFtmQAQk HS26UdJcsyzteEwpkp2xxjv3SSXFz1VJl6plCVq92A45JMKEEtGppUHlRY46kxMP+Vwd IGcQ== 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=IxwvaE0YmGct/RzoWtDeDc7kHgzj0Gomy2LP+TO3SVY=; b=i7g+j7MKXDb/3mEHvor7T4bKEJml8M5TOyozzb4xTajWvlP0WfVkYRtzU380q7mv7B swR34siMMkxO1hJmhRNpbGZEPIuodXbFAg4bgkGUkmXpYhQfXJ3YyLlwFW9RgcmXObHb WBQfZFdeQjYMyLvijNp0xdmP8aRh3svf7HU+7LR134GSX98qwPJiCX/S4lsIW5fN9fIy kw9KojYKBYUoapQT5JHwL9g+J1QB4JU1vN/CGBsnKjZbdFD44Zt3cCuGPfHEX0M7ys8m A1M1TZpSNLAKVj7469wLQdWZj9fzwlCwvGwaOcIV50t2ymwrlHXctPbsnEDiYx75aidz xdfw== X-Gm-Message-State: APjAAAVjL54zxs8CsPawemkQyBL/oKKuls+qFMjwqi0o1tpA6BQ0KJhx slOkqS4SjeD28nz2fqP1sGmUcw4N X-Google-Smtp-Source: APXvYqxWbUtCflk2jf3nwrk81TtZbGXVJHCc0gKdgTRxL5gOZTPRdT9C+8QaZIXoe1RvkvSmdGNmGg== X-Received: by 2002:a7b:c7d6:: with SMTP id z22mr4531934wmk.54.1558002416041; Thu, 16 May 2019 03:26:56 -0700 (PDT) Received: from amir-ThinkPad-T480.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id d72sm4506299wmd.12.2019.05.16.03.26.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 May 2019 03:26:55 -0700 (PDT) From: Amir Goldstein To: Jan Kara Cc: Matthew Bobrowski , linux-fsdevel@vger.kernel.org Subject: [PATCH v2 02/14] fs: create simple_remove() helper Date: Thu, 16 May 2019 13:26:29 +0300 Message-Id: <20190516102641.6574-3-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190516102641.6574-1-amir73il@gmail.com> References: <20190516102641.6574-1-amir73il@gmail.com> 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 There is a common pattern among pseudo filesystems for removing a dentry from code paths that are NOT coming from vfs_{unlink,rmdir}, using a combination of simple_{unlink,rmdir} and d_delete(). Create an helper to perform this common operation. This helper is going to be used as a place holder for the new fsnotify_{unlink,rmdir} hooks. Signed-off-by: Amir Goldstein --- fs/libfs.c | 27 +++++++++++++++++++++++++++ include/linux/fs.h | 1 + 2 files changed, 28 insertions(+) diff --git a/fs/libfs.c b/fs/libfs.c index 4b59b1816efb..ca1132f1d5c6 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -353,6 +353,33 @@ int simple_rmdir(struct inode *dir, struct dentry *dentry) } EXPORT_SYMBOL(simple_rmdir); +/* + * Unlike simple_unlink/rmdir, this helper is NOT called from vfs_unlink/rmdir. + * Caller must guaranty that d_parent and d_name are stable. + */ +int simple_remove(struct inode *dir, struct dentry *dentry) +{ + int ret; + + /* + * 'simple_' operations get a dentry reference on create/mkdir and drop + * it on unlink/rmdir. So we have to get dentry reference here to + * protect d_delete() from accessing a freed dentry. + */ + dget(dentry); + if (d_is_dir(dentry)) + ret = simple_rmdir(dir, dentry); + else + ret = simple_unlink(dir, dentry); + + if (!ret) + d_delete(dentry); + dput(dentry); + + return ret; +} +EXPORT_SYMBOL(simple_remove); + int simple_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry, unsigned int flags) diff --git a/include/linux/fs.h b/include/linux/fs.h index f7fdfe93e25d..74ea5f0b3b9d 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -3245,6 +3245,7 @@ extern int simple_open(struct inode *inode, struct file *file); extern int simple_link(struct dentry *, struct inode *, struct dentry *); extern int simple_unlink(struct inode *, struct dentry *); extern int simple_rmdir(struct inode *, struct dentry *); +extern int simple_remove(struct inode *, struct dentry *); extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *, unsigned int); extern int noop_fsync(struct file *, loff_t, loff_t, int); From patchwork Thu May 16 10:26:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10946275 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 918D81395 for ; Thu, 16 May 2019 10:27:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 809C9288F8 for ; Thu, 16 May 2019 10:27:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 753F728978; Thu, 16 May 2019 10:27:00 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 0B964288F8 for ; Thu, 16 May 2019 10:27:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726870AbfEPK07 (ORCPT ); Thu, 16 May 2019 06:26:59 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:34523 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726336AbfEPK07 (ORCPT ); Thu, 16 May 2019 06:26:59 -0400 Received: by mail-wr1-f66.google.com with SMTP id f8so1360169wrt.1 for ; Thu, 16 May 2019 03:26:58 -0700 (PDT) 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=A0Dx9rFPmZQefRZr4daUw4n6bOKu6DHR/Y1PSc2RiRM=; b=NxIv7Ru/CPrQJspXqnkb8ea01W++OecOZSsF8ijZUtLoruRVUvoDUxXds4nJYCNW4h 4DZtbXWvr9j+YA3s8dZR57YY0Fe1CNUQCzH4ibLAkRpYzJm4hrF5P3oJo03VGDpPa35w dlGYsKydq7Q1Sez1Dp2jhF+TjEjLVIxDWsN18eKzOdqu1il67fCwci39hopYin9WMq8s eId8AT+yXDg72pZJxLC3uBIsVve9ld/5dTGWg+eZzgAChSGoH9wc2BqVgF9prXKqHl+j gYkAaARDejAyQ4Y/OaBM+JwgmRKlSZfQvU/gOifGDFSugvIrwxLrmNZhUTAhzCkeqpeo dVvg== 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=A0Dx9rFPmZQefRZr4daUw4n6bOKu6DHR/Y1PSc2RiRM=; b=Hrrx6pp9dli+WUTssOaF+dYbknM3sPI9F8DqSFtSI5uw6RGb0d1qYlx/sT9SGG1af1 3gsGgxq1IJPeYXuqYW6+jyPXlJjWls9MqBrlVOwC+Rvgctf/Nvqiog2cMbEoBrik3tZG zgbkEoapKE3EvyImVQ66aix6IC+HA/n7hh1I6oH31CoHJkz+wvqSVE8nulp9dslW2kBF mg+hKW0XL+Sbc2/cWzON4gYtuPdw/KCSkRsf6dShcFp7W3iLkX0nGN0ATLSZgNLqQrdS H4TWvQrGIPRnE+j/suFZEfHaqefD0zHI4oVEorUHETPz3Xff3o975/Qpyd/P3EFYthOD 0+Cw== X-Gm-Message-State: APjAAAVHHbNJ8HatbDtxrWQUKAGWvNNOPjOeRqHy8kClvuPEclZpqiIa Ft9YPTMBdwtJAvX0jjWZ9MI= X-Google-Smtp-Source: APXvYqw4TF5UwwX1u75F0wJCXhOzxPxESOc5yLPE9a1uOTEIpCdW9hvkNBOJzSEO/1xOcOPPVwM5kA== X-Received: by 2002:adf:e44b:: with SMTP id t11mr14804686wrm.151.1558002417463; Thu, 16 May 2019 03:26:57 -0700 (PDT) Received: from amir-ThinkPad-T480.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id d72sm4506299wmd.12.2019.05.16.03.26.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 May 2019 03:26:56 -0700 (PDT) From: Amir Goldstein To: Jan Kara Cc: Matthew Bobrowski , linux-fsdevel@vger.kernel.org Subject: [PATCH v2 03/14] fsnotify: add empty fsnotify_{unlink,rmdir}() hooks Date: Thu, 16 May 2019 13:26:30 +0300 Message-Id: <20190516102641.6574-4-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190516102641.6574-1-amir73il@gmail.com> References: <20190516102641.6574-1-amir73il@gmail.com> 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 We would like to move fsnotify_nameremove() calls from d_delete() into a higher layer where the hook makes more sense and so we can consider every d_delete() call site individually. Start by creating empty hook fsnotify_{unlink,rmdir}() and place them in the proper VFS call sites. After all d_delete() call sites will be converted to use the new hook, the new hook will generate the delete events and fsnotify_nameremove() hook will be removed. Signed-off-by: Amir Goldstein --- fs/libfs.c | 11 ++++++++--- fs/namei.c | 2 ++ include/linux/fsnotify.h | 26 ++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/fs/libfs.c b/fs/libfs.c index ca1132f1d5c6..4db61ca8cc94 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -367,11 +368,15 @@ int simple_remove(struct inode *dir, struct dentry *dentry) * protect d_delete() from accessing a freed dentry. */ dget(dentry); - if (d_is_dir(dentry)) + if (d_is_dir(dentry)) { ret = simple_rmdir(dir, dentry); - else + if (!ret) + fsnotify_rmdir(dir, dentry); + } else { ret = simple_unlink(dir, dentry); - + if (!ret) + fsnotify_unlink(dir, dentry); + } if (!ret) d_delete(dentry); dput(dentry); diff --git a/fs/namei.c b/fs/namei.c index 20831c2fbb34..209c51a5226c 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3883,6 +3883,7 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry) dentry->d_inode->i_flags |= S_DEAD; dont_mount(dentry); detach_mounts(dentry); + fsnotify_rmdir(dir, dentry); out: inode_unlock(dentry->d_inode); @@ -3999,6 +4000,7 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry, struct inode **delegate if (!error) { dont_mount(dentry); detach_mounts(dentry); + fsnotify_unlink(dir, dentry); } } } diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index 94972e8eb6d1..7f23eddefcd0 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h @@ -188,6 +188,19 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, &new_dentry->d_name, 0); } +/* + * fsnotify_unlink - 'name' was unlinked + * + * Caller must make sure that dentry->d_name is stable. + */ +static inline void fsnotify_unlink(struct inode *dir, struct dentry *dentry) +{ + /* Expected to be called before d_delete() */ + WARN_ON_ONCE(d_is_negative(dentry)); + + /* TODO: call fsnotify_dirent() */ +} + /* * fsnotify_mkdir - directory 'name' was created */ @@ -198,6 +211,19 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry) fsnotify_dirent(inode, dentry, FS_CREATE | FS_ISDIR); } +/* + * fsnotify_rmdir - directory 'name' was removed + * + * Caller must make sure that dentry->d_name is stable. + */ +static inline void fsnotify_rmdir(struct inode *dir, struct dentry *dentry) +{ + /* Expected to be called before d_delete() */ + WARN_ON_ONCE(d_is_negative(dentry)); + + /* TODO: call fsnotify_dirent() */ +} + /* * fsnotify_access - file was read */ From patchwork Thu May 16 10:26:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10946277 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 8A260924 for ; Thu, 16 May 2019 10:27:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 799B2288F8 for ; Thu, 16 May 2019 10:27:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6E16E28978; Thu, 16 May 2019 10:27:01 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 1C85C288F8 for ; Thu, 16 May 2019 10:27:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726876AbfEPK1A (ORCPT ); Thu, 16 May 2019 06:27:00 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:35523 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726864AbfEPK1A (ORCPT ); Thu, 16 May 2019 06:27:00 -0400 Received: by mail-wr1-f68.google.com with SMTP id m3so2599392wrv.2 for ; Thu, 16 May 2019 03:26:59 -0700 (PDT) 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=SXMAy2Tc7pT34BBm6t9XXqikNr+mRicfmU61npbyIgI=; b=jL1J7kQdPji14blEw0M8jwiLkTdXTMEQmh2dXPwDWYIbP1TFYG4i+ir11TjhlWe5lP 2OEKKmuY7akVnOp7SnTkGvhBtyRXFRKFuFpw1evTy5BC/n6cc9LGguwgfwyFJxd7c+fu OEPRrAjymaCFpk4S2Q+WZGEKliEN8iE8vbdC3Wd/y4362v7FcN6yJMEXuAEchyBMZbM+ 6C0sT7+iMupdTWZ+96pCv/t10HBfGd8QuvWuoj7uL2WrsKOVMka/Xln26HEkZP9HF+/o 3BkH2wNfoDbQSzXL1/0ibk4sfQNel7vBzuGcpEVmOdzWJFUWHTZR+2yApySeM2DrQ9ed GSqg== 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=SXMAy2Tc7pT34BBm6t9XXqikNr+mRicfmU61npbyIgI=; b=i475010Z+Y+rrcd3ZjuzPUnFYhtrsGsRs6JoJTJEdN/WXKDj8FPmRp2PI/nditTkAF SIz0mh4jhpTKMEPtvfH5//9coDccaRolo76SKqfBzDqS6bFkHDK6wo/b162voqR+7mw1 3eaQ6J6q0Jrhb2yvi4y9P/ytqwo8FM4ivkq6ZddOELBi2VDK8DHpuYChIA+wlHgieOrf TU4jnpE55Wvuc00OrfyylRYIJLrND2G0YnlTbfzbtu6MX1FxoZ0ys5s/wVEMlPAf2Kio 7sIqQAQI1CNANZr2o+ERD7/4YAEgh8XxsW5bQicwfI3a0KwtWEPkGsACFlJ8h/u3UeNp AjeA== X-Gm-Message-State: APjAAAUGPiAElUnWZ/3U/3ZvSed1a/M/druFVAzuaYHzJfAxcKElVH5U KqhIHXpW6xFgJiqrF9q+kxA= X-Google-Smtp-Source: APXvYqwwwi3xERo0k5rImNc+Acp075Bd/gzEsROFwphCTl/dAigUfPXagw9LqYlP5MyDkfHYClPTWQ== X-Received: by 2002:adf:f3ca:: with SMTP id g10mr5890386wrp.249.1558002418729; Thu, 16 May 2019 03:26:58 -0700 (PDT) Received: from amir-ThinkPad-T480.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id d72sm4506299wmd.12.2019.05.16.03.26.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 May 2019 03:26:58 -0700 (PDT) From: Amir Goldstein To: Jan Kara Cc: Matthew Bobrowski , linux-fsdevel@vger.kernel.org, Martin Schwidefsky , Heiko Carstens Subject: [PATCH v2 04/14] fs: convert hypfs to use simple_remove() helper Date: Thu, 16 May 2019 13:26:31 +0300 Message-Id: <20190516102641.6574-5-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190516102641.6574-1-amir73il@gmail.com> References: <20190516102641.6574-1-amir73il@gmail.com> 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 This will allow generating fsnotify delete events after the fsnotify_nameremove() hook is removed from d_delete(). Cc: Martin Schwidefsky Cc: Heiko Carstens Signed-off-by: Amir Goldstein --- arch/s390/hypfs/inode.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c index ccad1398abd4..30a0ab967461 100644 --- a/arch/s390/hypfs/inode.c +++ b/arch/s390/hypfs/inode.c @@ -70,13 +70,8 @@ static void hypfs_remove(struct dentry *dentry) parent = dentry->d_parent; inode_lock(d_inode(parent)); - if (simple_positive(dentry)) { - if (d_is_dir(dentry)) - simple_rmdir(d_inode(parent), dentry); - else - simple_unlink(d_inode(parent), dentry); - } - d_delete(dentry); + if (simple_positive(dentry)) + simple_remove(d_inode(parent), dentry); dput(dentry); inode_unlock(d_inode(parent)); } From patchwork Thu May 16 10:26:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10946279 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 9B474924 for ; Thu, 16 May 2019 10:27:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8AE8B288F8 for ; Thu, 16 May 2019 10:27:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7EFB828978; Thu, 16 May 2019 10:27:03 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 61B0D288F8 for ; Thu, 16 May 2019 10:27:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726879AbfEPK1B (ORCPT ); Thu, 16 May 2019 06:27:01 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:39519 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726864AbfEPK1B (ORCPT ); Thu, 16 May 2019 06:27:01 -0400 Received: by mail-wr1-f68.google.com with SMTP id w8so2759787wrl.6 for ; Thu, 16 May 2019 03:27:00 -0700 (PDT) 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=92UflgOu/j9LiI2qc0tPQ67e3Dpk5CHT3nyHp7GlrTI=; b=jxY9UJJSDHi/1C15s6x7Jq9TrkOKpT3uktOIZi09F6SdMpMzYqx8UL3bMmKoDH9bfj eXRcuG/oo4wYQtyFs6DVNwUq1Z96K9ZS3zlQgoDy33n2NORxHeIZVhY7R0WFHZ2SbTvm ZCR134tAIsHoGoBo6iYzzwLLEwryve7450kH+imIVrNTmkx4r0xwsJp1z9lY1TiA1tRO f6yKYRDQRoFSSGb4iSI8zzgHG/+d8jskaZhvkFy5xRr45oC/vFu31a3XfV1HPy/EZV+S JIOjtsBeSldqInRVO8Pld/l/1p88aq2HmeFm9W23rECQdkS313EmkRvevJ8tBg51y72x EJTQ== 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=92UflgOu/j9LiI2qc0tPQ67e3Dpk5CHT3nyHp7GlrTI=; b=ccBqrTsHoJPeOLHhMg1CaEEGDDgAwIt5pBnUDF3wcN/3sKpQkoRLcLx+XNDYDWAf2h bUg5Vjf56Hvug+sxSi89XcP+ID4kr/keuwJen2nnC+gLlEurLcoDMyZWeV85YQ8lMC8W oBAsUSJIyJex9IART13nr2SYrP6/vQKiF6+TEJNZN8ERSRxRP7sRDXcKYYX8yYQF2N40 YSR/luTKMg9iaC/276/DRCuI3lF5as5RDJp3cDtU0DYooStypP0IzEClJd4VYo7xlvA+ q308M47itvLcOO8DPir7cNxP4FG1rR77MzjZPp6VzAK5gclztZT7bGv/r9y2LCQySIEq 38Xw== X-Gm-Message-State: APjAAAWiVZKYEbXqh2GL9LwojmL+zbk0WZTeXXj1D8ceiHuk4ktKy/Mb vbRPB/iDQ0XKJx6f+z2AidY= X-Google-Smtp-Source: APXvYqwMpEKMjmzaFSlC8Je1xQi2QUOmJORHyMcbF53z2ojiMNExkV9/Qh5C/lbV+6hHWAonKwmf/g== X-Received: by 2002:adf:ebd2:: with SMTP id v18mr10948417wrn.108.1558002419996; Thu, 16 May 2019 03:26:59 -0700 (PDT) Received: from amir-ThinkPad-T480.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id d72sm4506299wmd.12.2019.05.16.03.26.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 May 2019 03:26:59 -0700 (PDT) From: Amir Goldstein To: Jan Kara Cc: Matthew Bobrowski , linux-fsdevel@vger.kernel.org, Doug Ledford , Jason Gunthorpe Subject: [PATCH v2 05/14] fs: convert qibfs/ipathfs to use simple_remove() helper Date: Thu, 16 May 2019 13:26:32 +0300 Message-Id: <20190516102641.6574-6-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190516102641.6574-1-amir73il@gmail.com> References: <20190516102641.6574-1-amir73il@gmail.com> 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 This will allow generating fsnotify delete events after the fsnotify_nameremove() hook is removed from d_delete(). Cc: Doug Ledford Cc: Jason Gunthorpe Signed-off-by: Amir Goldstein --- drivers/infiniband/hw/qib/qib_fs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/qib/qib_fs.c b/drivers/infiniband/hw/qib/qib_fs.c index ceb42d948412..795938a2488b 100644 --- a/drivers/infiniband/hw/qib/qib_fs.c +++ b/drivers/infiniband/hw/qib/qib_fs.c @@ -491,8 +491,7 @@ static int remove_device_files(struct super_block *sb, } remove_file(dir, "flash"); inode_unlock(d_inode(dir)); - ret = simple_rmdir(d_inode(root), dir); - d_delete(dir); + ret = simple_remove(d_inode(root), dir); dput(dir); bail: From patchwork Thu May 16 10:26:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10946281 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 4BDD2924 for ; Thu, 16 May 2019 10:27:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C19A288F8 for ; Thu, 16 May 2019 10:27:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 306C428978; Thu, 16 May 2019 10:27:04 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 CE85E288F8 for ; Thu, 16 May 2019 10:27:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726900AbfEPK1D (ORCPT ); Thu, 16 May 2019 06:27:03 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:34529 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726864AbfEPK1D (ORCPT ); Thu, 16 May 2019 06:27:03 -0400 Received: by mail-wr1-f67.google.com with SMTP id f8so1360395wrt.1 for ; Thu, 16 May 2019 03:27:01 -0700 (PDT) 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=8uMm+ah3xFXkku1nch1pEhGBu98y4pTUZbVq8XNm008=; b=UBIC8UNAa5NZRHO4B/F7lPCcdDz7U1hVhcDs1YxYW8+MgYyUVRj/Lv37RXutRepUKz fz7f6K2AZ5eRC741zKosqYdmuSTDjOXwYlmGZkQoVpd08GXPeKfVlBSIwz/zjKeIoP2M ZpreUTGkLelLQiEj9//X3ajkiNtMhOa+HbI+AGFyzWYMtKtLstgCUIR1ToLvpKgTQj75 1o4LETVQz5dkdEdQrzAkFzY/nWm4Y2PAlTAVHF+PX8QuJ9lfAQv9NpgGShXKTwmStszj D4217S77mTjOkKW01vKbuPyPjKzeY3ZbJGEIOanU2ODGPOjX9eAmy9MI59IbeBAwNmQk dAyw== 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=8uMm+ah3xFXkku1nch1pEhGBu98y4pTUZbVq8XNm008=; b=K0NNSMNhio+BN3bYzIrwa7dCHK/bjQ2yg/UqGCzucCy9bvK3NBMiEjbc/iAfBUbxub rmAISaeOq2s2ttGsr9vqDM477uovITW2Cr6Rf2tDFOcSCJ6QO4QU5uxPG/+CKLCtkVFU /9UtbaFzUW733OtU+pk88kjQh17Da+tGfWh2Ue5oAjwU1nrZ5xVFA58R6QH2rnFsgYGL 8/vH6OmxXIupudJ3qpwTpwGDrhx2/IqTzGk117q/lr8lxaS7yBFlvuq5eULtF1Ms3VT0 0aSxGWVd7tkCdGyiG48Ql9rTVQeguVo9nJ9oQS846PyMRZBqZYb8+4FmKoayocQlvWbP 81cQ== X-Gm-Message-State: APjAAAVutxs7zDvzBw5F8wwqs5Nc6pQy8+bl+XT3vUAGPpQ42W26Jf/V 2gAVoBgPZUBFPaIep8vp1U6mDnxj X-Google-Smtp-Source: APXvYqxcZZIvatMaOm++md73i5zZYn8rj7fZPVd1moKnVpDsVFMP6tWhMWoNiMtMY50VASTOpoJvzw== X-Received: by 2002:adf:f2c7:: with SMTP id d7mr26836621wrp.320.1558002421216; Thu, 16 May 2019 03:27:01 -0700 (PDT) Received: from amir-ThinkPad-T480.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id d72sm4506299wmd.12.2019.05.16.03.27.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 May 2019 03:27:00 -0700 (PDT) From: Amir Goldstein To: Jan Kara Cc: Matthew Bobrowski , linux-fsdevel@vger.kernel.org, Greg Kroah-Hartman Subject: [PATCH v2 06/14] fs: convert debugfs to use simple_remove() helper Date: Thu, 16 May 2019 13:26:33 +0300 Message-Id: <20190516102641.6574-7-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190516102641.6574-1-amir73il@gmail.com> References: <20190516102641.6574-1-amir73il@gmail.com> 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 This will allow generating fsnotify delete events after the fsnotify_nameremove() hook is removed from d_delete(). Cc: Greg Kroah-Hartman Signed-off-by: Amir Goldstein --- fs/debugfs/inode.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index acef14ad53db..bc96198df1d4 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c @@ -617,13 +617,10 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent, } EXPORT_SYMBOL_GPL(debugfs_create_symlink); -static void __debugfs_remove_file(struct dentry *dentry, struct dentry *parent) +static void __debugfs_file_removed(struct dentry *dentry) { struct debugfs_fsdata *fsd; - simple_unlink(d_inode(parent), dentry); - d_delete(dentry); - /* * Paired with the closing smp_mb() implied by a successful * cmpxchg() in debugfs_file_get(): either @@ -643,18 +640,9 @@ static int __debugfs_remove(struct dentry *dentry, struct dentry *parent) int ret = 0; if (simple_positive(dentry)) { - dget(dentry); - if (!d_is_reg(dentry)) { - if (d_is_dir(dentry)) - ret = simple_rmdir(d_inode(parent), dentry); - else - simple_unlink(d_inode(parent), dentry); - if (!ret) - d_delete(dentry); - } else { - __debugfs_remove_file(dentry, parent); - } - dput(dentry); + ret = simple_remove(d_inode(parent), dentry); + if (d_is_reg(dentry)) + __debugfs_file_removed(dentry); } return ret; } From patchwork Thu May 16 10:26:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10946283 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 6E8771395 for ; Thu, 16 May 2019 10:27:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5193E28971 for ; Thu, 16 May 2019 10:27:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4523C28A39; Thu, 16 May 2019 10:27:05 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 CF96F28971 for ; Thu, 16 May 2019 10:27:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726902AbfEPK1E (ORCPT ); Thu, 16 May 2019 06:27:04 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:32826 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726894AbfEPK1D (ORCPT ); Thu, 16 May 2019 06:27:03 -0400 Received: by mail-wr1-f68.google.com with SMTP id d9so2809841wrx.0 for ; Thu, 16 May 2019 03:27:03 -0700 (PDT) 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=FwPQy0s/vjrkcLjVIUF8opKYwDegn02HiNSftLAbhlc=; b=rvZPpXM5s90ZCj5aclCMnAkn+zA0uiyEOixfG006T69B8iJzzQVF3VEKXQ0iJqKi5R um5TM8zRhaxsO40nUa3DG0rwIrA2PYfb8z3VKFTycnOfAJ7KU08yeu2wWfRVJLa+JYkS wa2Uxv6jThU/SRd4ggGnyaJe/cZ/IAdhmsUejP5zrWTxo1FT6iNGyRCJ5Z/giUHWQ8gt OET+VyoPHMw0VmoL5SG5eJJDtovvLGrVKwxRjwypUiDwt+VR7C559Af+OmFxWd4B/P6h MQxmx0w+PoR0VcnyFQu80VmA39fgK4vnlC7WqFypd56t5EsTgQEHA8N/fw+YK+Q7GoSX A4HA== 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=FwPQy0s/vjrkcLjVIUF8opKYwDegn02HiNSftLAbhlc=; b=T9AGxkfrwbE4z1mepR7BicPuW7vK4JY+CLs/uxxRJOkhCPHpqQb1Tp3we0qagzWJzl 6aVMCCkid8YAtvfXtQr3LEm2ZBGAcEld1fRtkIFv6b42w8r8DDlmJyQcrj+l4M98IEh+ jJKnbWbe9EPvc1Q/dOpWTMsufyYLCgngRMG6tJFKwMQlSz1Ljp2wm9iIlu7eCOWHy2eZ r+rd+IGjGoCKHEVPmhFpws3wCQYwFITSCLgdIknmorrsA5jlfe25KvLpMIndLGmkjtNT OUwelWvBjkcrKyZLsGiAtjNkPO1xzUUAhq9nwOZUKzBAcFFmxaerJRIgDpBp96phKfM6 47IQ== X-Gm-Message-State: APjAAAXzyGMvspt7vBxnybGduISZHcW30gor8Ay84BvX0D3uDWNppNTL E7h2yD7hDF1OVLFpDvxLvisZRdGD X-Google-Smtp-Source: APXvYqz2ebFQWv2JC9gRyJuqZ/g4oFldiMpUaoQe6Z0H14PFik47XsfNU0rk4sUz2PPxFzeA/txwug== X-Received: by 2002:a5d:4d51:: with SMTP id a17mr29368254wru.260.1558002422563; Thu, 16 May 2019 03:27:02 -0700 (PDT) Received: from amir-ThinkPad-T480.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id d72sm4506299wmd.12.2019.05.16.03.27.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 May 2019 03:27:01 -0700 (PDT) From: Amir Goldstein To: Jan Kara Cc: Matthew Bobrowski , linux-fsdevel@vger.kernel.org, Steven Rostedt Subject: [PATCH v2 07/14] fs: convert tracefs to use simple_remove() helper Date: Thu, 16 May 2019 13:26:34 +0300 Message-Id: <20190516102641.6574-8-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190516102641.6574-1-amir73il@gmail.com> References: <20190516102641.6574-1-amir73il@gmail.com> 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 This will allow generating fsnotify delete events after the fsnotify_nameremove() hook is removed from d_delete(). Cc: Steven Rostedt Signed-off-by: Amir Goldstein Acked-by: Steven Rostedt (VMware) --- fs/tracefs/inode.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c index 7098c49f3693..6ac31ea9ad5d 100644 --- a/fs/tracefs/inode.c +++ b/fs/tracefs/inode.c @@ -501,25 +501,10 @@ __init struct dentry *tracefs_create_instance_dir(const char *name, static int __tracefs_remove(struct dentry *dentry, struct dentry *parent) { - int ret = 0; - - if (simple_positive(dentry)) { - if (dentry->d_inode) { - dget(dentry); - switch (dentry->d_inode->i_mode & S_IFMT) { - case S_IFDIR: - ret = simple_rmdir(parent->d_inode, dentry); - break; - default: - simple_unlink(parent->d_inode, dentry); - break; - } - if (!ret) - d_delete(dentry); - dput(dentry); - } - } - return ret; + if (simple_positive(dentry)) + return simple_remove(d_inode(parent), dentry); + + return 0; } /** From patchwork Thu May 16 10:26:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10946285 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 A2ED61395 for ; Thu, 16 May 2019 10:27:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9327128971 for ; Thu, 16 May 2019 10:27:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87A0E28A49; Thu, 16 May 2019 10:27: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 E476028971 for ; Thu, 16 May 2019 10:27:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726911AbfEPK1G (ORCPT ); Thu, 16 May 2019 06:27:06 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:34535 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726894AbfEPK1F (ORCPT ); Thu, 16 May 2019 06:27:05 -0400 Received: by mail-wr1-f65.google.com with SMTP id f8so1360582wrt.1 for ; Thu, 16 May 2019 03:27:04 -0700 (PDT) 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=R3uh6IyNVfDGyHyrBptvQoODhPii0EVUznyG2VjUhjU=; b=N+FShchWGe+JKxtDpOy+uJQQjiykGm7/UR2PYJMWY6HoG1GUIr8VPHhgBSDsnX6DL7 5gETlU1zmTy+wn4TXVBw3CpR9fytQYCMNB2H0o2NGl7R5KYls+pPw4uj5lhML5FVGB9R i6RsJwurPXK/qOKNvk1GKJBs89VpuJHgs4KKtEy+f097yGQ3YfGEsFSxh/IH05KM9vOn +QB2Ckx+FytOvIAV5FmtV9a0MK8aE6z6V3H7CXTGOqGrABnfKc9b/yzo+cvwHD+PMZL5 KlSE6q6Btremh1ZhIgRDrA3ffC1x/adAn9MEGdqrO2P0L8muMt5JqTAAZrZ/4lUYKVSf +OLw== 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=R3uh6IyNVfDGyHyrBptvQoODhPii0EVUznyG2VjUhjU=; b=Tc75LjI71UmqCtKWQ4fEHAMh+sMnLT76aiZuoXvJFy4jfA+f6kXmsfMIiyhZiV1e5q kT/NrtGr6GYuTnQDpZN5+Os4HfayFoICpDRuY//dz+VcQSwpjoZtRY6zuJRoKzVLAQfW EA9Vj+YmJuxfAQPBt16hQ4oVT0nASbaVfgXrg9sYdxPXBK+2IUOlgP3aV7LtZfbYAv2d 9HjZs909rpYM0im23lk33XIdrBuuZjmaJVyggyYjgOU5XXEGoevJ+kMjpU/w9vq0BA/Z UTsVdsVIqdru1GDzA7iJxQdfCxJNkZEQL9qZEGM8vXPVop4ij+32kGKrqhOADmkrcTAx OFgw== X-Gm-Message-State: APjAAAV3uAfXgIC/7M3yawjbbB2AX89+ZGzQ4XvFg8RGw+2Lr9Mnk72/ 4ntS8NV721pZdTFlkJFnxaCr24U1 X-Google-Smtp-Source: APXvYqyzPEa5b2XOcRqZ5EFiI4+koS8ZUp7NIgBYmossQxgfbRemHUxK3qfOhjpV+7TN0XgHafI8Ng== X-Received: by 2002:adf:dd51:: with SMTP id u17mr26080911wrm.150.1558002424202; Thu, 16 May 2019 03:27:04 -0700 (PDT) Received: from amir-ThinkPad-T480.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id d72sm4506299wmd.12.2019.05.16.03.27.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 May 2019 03:27:03 -0700 (PDT) From: Amir Goldstein To: Jan Kara Cc: Matthew Bobrowski , linux-fsdevel@vger.kernel.org, Trond Myklebust , Anna Schumaker Subject: [PATCH v2 08/14] fs: convert rpc_pipefs to use simple_remove() helper Date: Thu, 16 May 2019 13:26:35 +0300 Message-Id: <20190516102641.6574-9-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190516102641.6574-1-amir73il@gmail.com> References: <20190516102641.6574-1-amir73il@gmail.com> 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 This will allow generating fsnotify delete events after the fsnotify_nameremove() hook is removed from d_delete(). Cc: Trond Myklebust Cc: Anna Schumaker Signed-off-by: Amir Goldstein --- net/sunrpc/rpc_pipe.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 979d23646e33..5b1a59776b9a 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c @@ -593,24 +593,12 @@ static int __rpc_mkpipe_dentry(struct inode *dir, struct dentry *dentry, static int __rpc_rmdir(struct inode *dir, struct dentry *dentry) { - int ret; - - dget(dentry); - ret = simple_rmdir(dir, dentry); - d_delete(dentry); - dput(dentry); - return ret; + return simple_remove(dir, dentry); } static int __rpc_unlink(struct inode *dir, struct dentry *dentry) { - int ret; - - dget(dentry); - ret = simple_unlink(dir, dentry); - d_delete(dentry); - dput(dentry); - return ret; + return simple_remove(dir, dentry); } static int __rpc_rmpipe(struct inode *dir, struct dentry *dentry) From patchwork Thu May 16 10:26:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10946287 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 E75C6924 for ; Thu, 16 May 2019 10:27:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D759228971 for ; Thu, 16 May 2019 10:27:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBF1728A39; Thu, 16 May 2019 10:27: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 6D7E728978 for ; Thu, 16 May 2019 10:27:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726923AbfEPK1G (ORCPT ); Thu, 16 May 2019 06:27:06 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:39529 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726906AbfEPK1G (ORCPT ); Thu, 16 May 2019 06:27:06 -0400 Received: by mail-wr1-f66.google.com with SMTP id w8so2760151wrl.6 for ; Thu, 16 May 2019 03:27:05 -0700 (PDT) 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=PiKGye4OdnurD2UG7Qy/Yk+AdnxTE8ZqIDQFphGQPkE=; b=Yl+dSSqlN+wslK/raRN19OJkoIjmmXZIR3TWFavXbZVWpLg5qqG1ebXRfipBuiIMgx iw3g4ciBL81SIatUw8wZjCoV+CK5RnaJQ84FBx7oZYhMqoIQFjkmUcWPVPtO706Jh6F1 MBMzH+9HV3yh+lypyGZgEt40GtvijSL3TePEbfEbaVBDSlHJtSxR+sOIZh2AxTttb5Wa lgW8OuPWqfrsJOFS9dWLt00PAJbErihyuW8/IiEF5i4eu/PYQRm1weQcQwbC/2uu0fWd zRU7cCQR1ZeIY9j1LFIoxO2XKwKAHNW+HmjroIS5CLaf3JEFX9q8bcmk83lNoEU6dSZg vDcA== 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=PiKGye4OdnurD2UG7Qy/Yk+AdnxTE8ZqIDQFphGQPkE=; b=OrC4nu/DHhZCTrCLqoANR191Bi1dFVp8LCLSLRE4JY7PvCWFlMICvYyMPzZ2g4ucUv RqG0DFhmRWV6DVvdMr4rwzlyoFxb8rYIIIUisVDRlUT8H9hdUHV5vH48A8S3SjAVK5UJ SE2hXPqgb2MOvMy7OSPBsKks1IfcEIk5OH82jprWXj5Ac5DFJOxwvK1FuxSB3LfOnfcv WYOJ7wV1Y+wRz5tnZsItcfn4EOYSSvhXAPqnebdHNaVch2HtHp4z7d238vsxYELYdy9E E6658IVxZ2/a/RiL/IU46wJ0o+WkmKYCfyi9u++S9vkS3qGR7U4Hnt/0ag4CEZ1GmhmI Sxuw== X-Gm-Message-State: APjAAAXruRl0WUM1y999+5FGgHQUZER5LD44t8GHJU7Wwt4OM45CweVT NrEk1KZBdjsVDVDoHDWjUg8= X-Google-Smtp-Source: APXvYqzjyQgI992E9Xx0p8+ZbR77CncYwBlUsDhPiVT3IpMlIJzo5SFDece9dQnuhxRz/Crj8cm2Ww== X-Received: by 2002:adf:ebd2:: with SMTP id v18mr10948714wrn.108.1558002425341; Thu, 16 May 2019 03:27:05 -0700 (PDT) Received: from amir-ThinkPad-T480.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id d72sm4506299wmd.12.2019.05.16.03.27.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 May 2019 03:27:04 -0700 (PDT) From: Amir Goldstein To: Jan Kara Cc: Matthew Bobrowski , linux-fsdevel@vger.kernel.org, John Johansen Subject: [PATCH v2 09/14] fs: convert apparmorfs to use simple_remove() helper Date: Thu, 16 May 2019 13:26:36 +0300 Message-Id: <20190516102641.6574-10-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190516102641.6574-1-amir73il@gmail.com> References: <20190516102641.6574-1-amir73il@gmail.com> 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 This will allow generating fsnotify delete events after the fsnotify_nameremove() hook is removed from d_delete(). Cc: John Johansen Signed-off-by: Amir Goldstein --- security/apparmor/apparmorfs.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c index 9ab5613fe07c..4a10acb4a6d3 100644 --- a/security/apparmor/apparmorfs.c +++ b/security/apparmor/apparmorfs.c @@ -351,11 +351,7 @@ static void aafs_remove(struct dentry *dentry) dir = d_inode(dentry->d_parent); inode_lock(dir); if (simple_positive(dentry)) { - if (d_is_dir(dentry)) - simple_rmdir(dir, dentry); - else - simple_unlink(dir, dentry); - d_delete(dentry); + simple_remove(dir, dentry); dput(dentry); } inode_unlock(dir); From patchwork Thu May 16 10:26:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10946289 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 7D0EB924 for ; Thu, 16 May 2019 10:27:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D96A288F8 for ; Thu, 16 May 2019 10:27:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6221E28978; Thu, 16 May 2019 10:27:09 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 F1DE1288F8 for ; Thu, 16 May 2019 10:27:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726928AbfEPK1I (ORCPT ); Thu, 16 May 2019 06:27:08 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:40854 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726906AbfEPK1I (ORCPT ); Thu, 16 May 2019 06:27:08 -0400 Received: by mail-wm1-f68.google.com with SMTP id h11so2880612wmb.5 for ; Thu, 16 May 2019 03:27:07 -0700 (PDT) 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=qrosxJxuqEP56M8QLL8XGLvEr2oqgW0pZ3sFOuyMfuE=; b=KLQHueo8rjrYg+n+iHJNuSzgmEMZJty00fj6Osq1f2rni5RF3Wvg/9HrJ16uMAOlU9 AAXx+ADEe/fSBZHeppmmVjxTvXgO0TgcUcs8qX4N3pveQbsBTrHSJQyehh6sV9vog8Mo TeTg48DNPatuP1LMoXfPkDtyPlsbG54wA1OaRKkfsaNSbdRDXfErqnk1zKqKzGMdLzis 2N85524B99Rnrcr2R9hwmWxyI1trz/eWyAwme2MwKLDPQTMy2FkiSMI06LD4Aam49Q9c 5oGcGZ7wfqGtsivUzChSgu5GCYtllm/ORDq87/AVceviTT1P9+hQX34OQCiqmwf9J7rm 9AqA== 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=qrosxJxuqEP56M8QLL8XGLvEr2oqgW0pZ3sFOuyMfuE=; b=uGOQVkd80gwkHDQeH4SXda8vE+MUVhL1ydarijWhM5dBSOLqHX/gXHrBqfOQEUj/1+ W1LHkb+VrW2Du42yPKiV2SieQ9bjItzK4K7x/wEKKq0uOyf//W1eDlPb54LVpaP3NkUu QP/CtwdbCcckiCuNCMrGE4kGmLyDtp0ooOQlctQCMz+2zcotQbelhZoVvoLq/qJ+gMO4 g8CfKtMNDxpAx3y39XnTejZhA5bQeE3heysAExRZhhl4zuaYbcZAWwXbWfoL4u82jJjN zu8MQbDRIcTxtzEMTNnxj+OpygkhIxHeMEgHIAMwCepZyW5W8xxoVxBiSxMlLd2uFXjK PL9g== X-Gm-Message-State: APjAAAXZNNhC1MM90QvrzCVgVCJvoCfnP7W8aOdC4qUDIfEhV6MQI55y Q9hTCO1shwSJFNdd5DztUJM= X-Google-Smtp-Source: APXvYqyqiIidIIQ4dNlUy37u73XrHi7+F0kVr6hw5JmyrWCoGIWb2AiQMF1uM/ESQFSSzWzBPzYafQ== X-Received: by 2002:a1c:9c02:: with SMTP id f2mr13565242wme.8.1558002426780; Thu, 16 May 2019 03:27:06 -0700 (PDT) Received: from amir-ThinkPad-T480.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id d72sm4506299wmd.12.2019.05.16.03.27.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 May 2019 03:27:06 -0700 (PDT) From: Amir Goldstein To: Jan Kara Cc: Matthew Bobrowski , linux-fsdevel@vger.kernel.org, Chris Mason , Josef Bacik , David Sterba Subject: [PATCH v2 10/14] fsnotify: call fsnotify_rmdir() hook from btrfs Date: Thu, 16 May 2019 13:26:37 +0300 Message-Id: <20190516102641.6574-11-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190516102641.6574-1-amir73il@gmail.com> References: <20190516102641.6574-1-amir73il@gmail.com> 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 This will allow generating fsnotify delete events after the fsnotify_nameremove() hook is removed from d_delete(). Cc: Chris Mason Cc: Josef Bacik Cc: David Sterba Signed-off-by: Amir Goldstein Acked-by: David Sterba --- fs/btrfs/ioctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 6dafa857bbb9..2cfd1bfb3871 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -2930,8 +2930,10 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, inode_lock(inode); err = btrfs_delete_subvolume(dir, dentry); inode_unlock(inode); - if (!err) + if (!err) { + fsnotify_rmdir(dir, dentry); d_delete(dentry); + } out_dput: dput(dentry); From patchwork Thu May 16 10:26:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10946291 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 9AAF71395 for ; Thu, 16 May 2019 10:27:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89FBC288F8 for ; Thu, 16 May 2019 10:27:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E80028978; Thu, 16 May 2019 10:27:10 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 2A19F288F8 for ; Thu, 16 May 2019 10:27:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726941AbfEPK1J (ORCPT ); Thu, 16 May 2019 06:27:09 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:39068 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726906AbfEPK1J (ORCPT ); Thu, 16 May 2019 06:27:09 -0400 Received: by mail-wm1-f66.google.com with SMTP id n25so2526193wmk.4 for ; Thu, 16 May 2019 03:27:08 -0700 (PDT) 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=k2nXCJMpePJI+ALTBh04qK+bh4SwR5zHDxDAb4kBoHQ=; b=kHpLGlS+eFAAjajP7Uy9jlIn64KnhU4BAcHyAxj5EAdDtpeE0Rw9BOVXFN4yFh4s3H EAYTB5v+0Rndg4JLfkYAlLCyRrj1oxwlegXc7AGzsmglNmMztqxs0Rt8M/TR3tEeJfNN qppZn44x30Z83jcC33UmWmkmIud4g8UIhYkB2NOdYpR0Az3zn+Zja7zeUTsZcbBBmYsl sAwwsB2vWBy545WGe/P/nNT4SBoLZUI76OTgcwz21rCg3tLsYJ/xGkDgrtuLe7oOmSyb UBTaJv0uidtL6Q5hdjFZ5+YUW/Z41F2QWMq7FuX93/BghllKsECJo/Hn5xdC680yqVJO AXOw== 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=k2nXCJMpePJI+ALTBh04qK+bh4SwR5zHDxDAb4kBoHQ=; b=rPB4ywkVXwdqBvnTcSlH7fJE0vcV2pRCQeoewTcoHRY3ImVKN3gCgi+gXo0CfXd7qw +R+kZUcKXPL71PS2cVVcY5SVT+dPppUkOaMldVVVUwZbYF451Q+8WElxeRT264OL8Uzf tPAKhrN2L9Eo2MGXZuDKUT+ccNZ+KenzRkyocDsJtlBHb2QWXbNOKGCHmtg4zfs1407z /CTKIZ0gPaTJ7l1mw5h5AaS3gC4GEhnLyv8jxJ5yOz10+o6yVc14/ij6aGM+ln0HtHI1 IyNs8a7ayi19GqYBbEe9qzNuSpZMGHWsnvwexDUdmZ4d90GvZZwknc4LxUPvyCjfTQkh hclA== X-Gm-Message-State: APjAAAU6A8BTijn8EQvJQms4RIIzM8nVxBJuE2plCt/1UJ2VkHVWUst+ vEbjWknfSuvAR+L6hdJF6X4= X-Google-Smtp-Source: APXvYqyDsLNUCwJ/aNjwBcX6PJIkHMTADuPLI0smlwt5HIKoMfM+dOeDRvljISyUtEC1PkYGWBAySg== X-Received: by 2002:a1c:7a0d:: with SMTP id v13mr14471585wmc.44.1558002427981; Thu, 16 May 2019 03:27:07 -0700 (PDT) Received: from amir-ThinkPad-T480.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id d72sm4506299wmd.12.2019.05.16.03.27.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 May 2019 03:27:07 -0700 (PDT) From: Amir Goldstein To: Jan Kara Cc: Matthew Bobrowski , linux-fsdevel@vger.kernel.org, Joel Becker , Christoph Hellwig Subject: [PATCH v2 11/14] fsnotify: call fsnotify_rmdir() hook from configfs Date: Thu, 16 May 2019 13:26:38 +0300 Message-Id: <20190516102641.6574-12-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190516102641.6574-1-amir73il@gmail.com> References: <20190516102641.6574-1-amir73il@gmail.com> 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 This will allow generating fsnotify delete events after the fsnotify_nameremove() hook is removed from d_delete(). Cc: Joel Becker Cc: Christoph Hellwig Signed-off-by: Amir Goldstein --- fs/configfs/dir.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index 591e82ba443c..2356008029f7 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c @@ -27,6 +27,7 @@ #undef DEBUG #include +#include #include #include #include @@ -1797,6 +1798,7 @@ void configfs_unregister_group(struct config_group *group) configfs_detach_group(&group->cg_item); d_inode(dentry)->i_flags |= S_DEAD; dont_mount(dentry); + fsnotify_rmdir(d_inode(parent), dentry); d_delete(dentry); inode_unlock(d_inode(parent)); @@ -1925,6 +1927,7 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys) configfs_detach_group(&group->cg_item); d_inode(dentry)->i_flags |= S_DEAD; dont_mount(dentry); + fsnotify_rmdir(d_inode(root), dentry); inode_unlock(d_inode(dentry)); d_delete(dentry); From patchwork Thu May 16 10:26:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10946293 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 B85D91395 for ; Thu, 16 May 2019 10:27:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7C03288F8 for ; Thu, 16 May 2019 10:27:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9C4B728978; Thu, 16 May 2019 10:27:11 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 5821D288F8 for ; Thu, 16 May 2019 10:27:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726943AbfEPK1K (ORCPT ); Thu, 16 May 2019 06:27:10 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:39540 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726942AbfEPK1K (ORCPT ); Thu, 16 May 2019 06:27:10 -0400 Received: by mail-wr1-f68.google.com with SMTP id w8so2760411wrl.6 for ; Thu, 16 May 2019 03:27:09 -0700 (PDT) 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=PWquflfDaJrkdOvqQTXIMVF7HKc8rtuLphpMKMGCCts=; b=YFJpUywYtIQZm4ZzE3P2rX7fHSLab6f9svleAEad1mWpctbsi6Uwnge035bmCpRAoW DHXWdRgi6XjWo3MJxth45jVr1GahqBmA4Sq7S3tbeMHFoprW7at4uJtfCwINOldlzByQ 7WeG3Tuo8q3EL9NTuZ6+6ynqq3jfWJTG18KLk9AuU7BBWn5nTfZVvAPUFnJWNtKFsFB0 kVp2yKHCySHxUKZu36HnGwjZkhBq8oCRysC3l97NMo0ON0iusm6D4luD6cPzHh18jIz3 TYy6YZEq4UGxJioPfz/t8HaboR/KgZ7gcna562Yp/uTviD9o5ts6VB5Pczi49XW7VdXc yttg== 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=PWquflfDaJrkdOvqQTXIMVF7HKc8rtuLphpMKMGCCts=; b=sOaeJg4iDbGXTLvaJLKPj6mmzQQC8QiCtDF4FiB7pfB2wxy8XFOTaEE+kQHqJQ07FH ey99Rb8E9rpMTKeiIiBphB6BAEVud2QYpfPIfiLkn1yOKjohAP0juys3/6cjVYEjnptp AIDFIWaC2dpClDnDxCNTlY1fXtbfuB9toYhA0xX0jXFHblide4V8it1rDteLkaapGiAa YLLV+ZcvCYbs2OuOHV8K2mR64bkGQpcw8YmJYc0tq4SQUrPaZWXAiA2U6AerjcNGsK7a EYEBGSRer+wch2lBO1w0lKiwXvVqj2WX9tiMZEGG6WI6CIpYt/1NspYzx4nENjnjxiMv XDXA== X-Gm-Message-State: APjAAAUdrHPFie/MMBXFW4nMjUOVEGiDDmEyv1Xxxr4Td0NMScghVaQV AaBu5TXSYQv4PSsFPhL4H4jXZbHe X-Google-Smtp-Source: APXvYqyzRd52GVYuib8zBVHqDBy10DO88yW3PMo5HXb6+0WVyYQkF10FrjSH34FrmcghmpCYtO+Lgg== X-Received: by 2002:adf:eb89:: with SMTP id t9mr26667302wrn.109.1558002429070; Thu, 16 May 2019 03:27:09 -0700 (PDT) Received: from amir-ThinkPad-T480.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id d72sm4506299wmd.12.2019.05.16.03.27.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 May 2019 03:27:08 -0700 (PDT) From: Amir Goldstein To: Jan Kara Cc: Matthew Bobrowski , linux-fsdevel@vger.kernel.org Subject: [PATCH v2 12/14] fsnotify: call fsnotify_unlink() hook from devpts Date: Thu, 16 May 2019 13:26:39 +0300 Message-Id: <20190516102641.6574-13-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190516102641.6574-1-amir73il@gmail.com> References: <20190516102641.6574-1-amir73il@gmail.com> 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 This will allow generating fsnotify delete events after the fsnotify_nameremove() hook is removed from d_delete(). Signed-off-by: Amir Goldstein --- fs/devpts/inode.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index 553a3f3300ae..1d7844809f01 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c @@ -624,6 +624,7 @@ void devpts_pty_kill(struct dentry *dentry) dentry->d_fsdata = NULL; drop_nlink(dentry->d_inode); + fsnotify_unlink(d_inode(dentry->d_parent), dentry); d_delete(dentry); dput(dentry); /* d_alloc_name() in devpts_pty_new() */ } From patchwork Thu May 16 10:26:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10946295 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 092A5924 for ; Thu, 16 May 2019 10:27:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED51D288F8 for ; Thu, 16 May 2019 10:27:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1E5428978; Thu, 16 May 2019 10:27:12 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 7E7D0288F8 for ; Thu, 16 May 2019 10:27:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726951AbfEPK1M (ORCPT ); Thu, 16 May 2019 06:27:12 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:35796 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726856AbfEPK1L (ORCPT ); Thu, 16 May 2019 06:27:11 -0400 Received: by mail-wm1-f65.google.com with SMTP id q15so2911520wmj.0 for ; Thu, 16 May 2019 03:27:10 -0700 (PDT) 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=4bdjyR4m8h8raappyVKGgwLGodQevThJISEQQyBEVd0=; b=hNXLe8bVEIr5XSpNObJUIhCniKcDnvrTMIVEP2UCHFzCiF5yh4+k+vn/7dL27c+APF Vg/y2qa0yxQrv+Sg4bVEViBpNbaJSbsmyIZAhCNp/7wEa/e7CI6OfGWc6VKCBeQtpAku ruMerdftmocy3Bep5ziLJIw9JD0lkL7lS4m1W7zDN+uDXlskNrIWZIoQWf6IIXsUvc5t 8b6uK+rUB6nO+Mx7Yd02eJVRBKUy5hI5xFmXERMhD0uvWEG22/TcAB92jsWIgvSf8/4V vuCirExurqsYV7FJ2rqHN+dwu7sA4bX0rQMIAsSPgxin3Xob2SNc30K+a5JmzBPmPW4z bnFg== 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=4bdjyR4m8h8raappyVKGgwLGodQevThJISEQQyBEVd0=; b=r10IFsBx5UCrevp+qDbD//oruPJaAnwI2JTxF/oadZw1IuMRLFvSW/kWixweOC+so6 X99W712vwc+j2vVXPIKj9ZDWWU47qfFMRUBPaUe8aHANRxxe88HYUwY2Ed0+rwUaHtB3 /uhSnoWeF8XWfGXEMfubn7rvdXaEK47/+8vJt0qNrF4cmcZ4EwUMFm7cw6g/LBnrYeFw roNFJ9TTRe9QPw8uCqCp8CRB4HMGdbHc3dlDCNY91lqBXDempNIAO+n3gW5E22rc4rGT rFvDF0DZEKLQkGq7dECVLhmRBX7yIDYt2v9fHWb2vRyXIXlA3wKKBEMRB13tqbcL6lWt KKdA== X-Gm-Message-State: APjAAAX1uoEiXG09rOol0uvmPTL2TdgFW0WvEroTjKITBJVMEKIDHZH1 qDelhOzwhHnbA7gSpJ6RdI0= X-Google-Smtp-Source: APXvYqw3NLLfvU1o1DnqAolVULSgxqvZTqGIkorgVzpx1ZGTtKCR5PRTbA1oaTfMqqrGZl3RRMVh1Q== X-Received: by 2002:a7b:ce83:: with SMTP id q3mr25700394wmj.32.1558002430128; Thu, 16 May 2019 03:27:10 -0700 (PDT) Received: from amir-ThinkPad-T480.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id d72sm4506299wmd.12.2019.05.16.03.27.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 May 2019 03:27:09 -0700 (PDT) From: Amir Goldstein To: Jan Kara Cc: Matthew Bobrowski , linux-fsdevel@vger.kernel.org Subject: [PATCH v2 13/14] fsnotify: move fsnotify_nameremove() hook out of d_delete() Date: Thu, 16 May 2019 13:26:40 +0300 Message-Id: <20190516102641.6574-14-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190516102641.6574-1-amir73il@gmail.com> References: <20190516102641.6574-1-amir73il@gmail.com> 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 d_delete() was piggy backed for the fsnotify_nameremove() hook when in fact not all callers of d_delete() care about fsnotify events. For all callers of d_delete() that may be interested in fsnotify events, we made sure to call one of fsnotify_{unlink,rmdir}() hooks before calling d_delete(). Now we can move the fsnotify_nameremove() call from d_delete() to the fsnotify_{unlink,rmdir}() hooks. Two explicit calls to fsnotify_nameremove() from nfs/afs sillyrename are also removed. This will cause a change of behavior - nfs/afs will NOT generate an fsnotify delete event when renaming over a positive dentry. This change is desirable, because it is consistent with the behavior of all other filesystems. Signed-off-by: Amir Goldstein --- fs/afs/dir_silly.c | 5 ----- fs/dcache.c | 2 -- fs/nfs/unlink.c | 6 ------ include/linux/fsnotify.h | 2 ++ 4 files changed, 2 insertions(+), 13 deletions(-) diff --git a/fs/afs/dir_silly.c b/fs/afs/dir_silly.c index f6f89fdab6b2..d3494825d08a 100644 --- a/fs/afs/dir_silly.c +++ b/fs/afs/dir_silly.c @@ -57,11 +57,6 @@ static int afs_do_silly_rename(struct afs_vnode *dvnode, struct afs_vnode *vnode if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) afs_edit_dir_add(dvnode, &new->d_name, &vnode->fid, afs_edit_dir_for_silly_1); - - /* vfs_unlink and the like do not issue this when a file is - * sillyrenamed, so do it here. - */ - fsnotify_nameremove(old, 0); } _leave(" = %d", ret); diff --git a/fs/dcache.c b/fs/dcache.c index 8136bda27a1f..ce131339410c 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -2371,7 +2371,6 @@ EXPORT_SYMBOL(d_hash_and_lookup); void d_delete(struct dentry * dentry) { struct inode *inode = dentry->d_inode; - int isdir = d_is_dir(dentry); spin_lock(&inode->i_lock); spin_lock(&dentry->d_lock); @@ -2386,7 +2385,6 @@ void d_delete(struct dentry * dentry) spin_unlock(&dentry->d_lock); spin_unlock(&inode->i_lock); } - fsnotify_nameremove(dentry, isdir); } EXPORT_SYMBOL(d_delete); diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c index 52d533967485..0effeee28352 100644 --- a/fs/nfs/unlink.c +++ b/fs/nfs/unlink.c @@ -396,12 +396,6 @@ nfs_complete_sillyrename(struct rpc_task *task, struct nfs_renamedata *data) nfs_cancel_async_unlink(dentry); return; } - - /* - * vfs_unlink and the like do not issue this when a file is - * sillyrenamed, so do it here. - */ - fsnotify_nameremove(dentry, 0); } #define SILLYNAME_PREFIX ".nfs" diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index 7f23eddefcd0..0145073c2b42 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h @@ -199,6 +199,7 @@ static inline void fsnotify_unlink(struct inode *dir, struct dentry *dentry) WARN_ON_ONCE(d_is_negative(dentry)); /* TODO: call fsnotify_dirent() */ + fsnotify_nameremove(dentry, 0); } /* @@ -222,6 +223,7 @@ static inline void fsnotify_rmdir(struct inode *dir, struct dentry *dentry) WARN_ON_ONCE(d_is_negative(dentry)); /* TODO: call fsnotify_dirent() */ + fsnotify_nameremove(dentry, 1); } /* From patchwork Thu May 16 10:26:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10946297 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 89D6C1395 for ; Thu, 16 May 2019 10:27:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78202288F8 for ; Thu, 16 May 2019 10:27:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C2CC28978; Thu, 16 May 2019 10:27:14 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 F36EC288F8 for ; Thu, 16 May 2019 10:27:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726955AbfEPK1N (ORCPT ); Thu, 16 May 2019 06:27:13 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:45101 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726942AbfEPK1N (ORCPT ); Thu, 16 May 2019 06:27:13 -0400 Received: by mail-wr1-f66.google.com with SMTP id b18so2717035wrq.12 for ; Thu, 16 May 2019 03:27:11 -0700 (PDT) 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=9d358PysRh93Ovn290SWir3DJbBZNRuE7uqJqn8lz2E=; b=hUaK4FqIbIojd0muP1USNHmCUTxPOfCy8VGGkgL08PykDQ7qtvsgqUzsjkZJ9vAQ61 phvvW0akXssZbsENnXZ1UvUGIyGkTDecvZ0V/OrplQwDcU7J+14/B2wLDiEiZ0FCrtws eSk7wsYuyH6xdzShAXdr9NpYqsTJhuaowo1CaA65LvQtORqyUTQE4Ga+uzvczuaed2mB Cqg6t6z1K0jwZBUylCR3P+J0qJQZyuHDVptoVk/mYH7hKO9AllBOHkGr3T/63XK4Ml5k ddFZZTs487xSU30Rnuu498UdaTW+JvGSIkCYyjMx8E4WhA71xo0b3g7DiFwgwkQUqjlQ a3dg== 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=9d358PysRh93Ovn290SWir3DJbBZNRuE7uqJqn8lz2E=; b=gwuVjb07V0uZfrYPmbitEsdWTqCy9/rwRB1FKhvOZ43iAnaxlnmgwzWS9AxKnlHwdw 0INPrUyIv72gt4pGGwAmY1W2OuqhuJnCgoLt3jLJksJJU/1VEU7mL0Q6V+5QT91ICl79 zdWhIohdfI8QTQZsS3cyUU1OsxIm95rDJS8+qN/H4cUVmfFAs7wQWJ9m0F4i9PoOUrBf kNkN4zXCXNsaEaNCAJCUl5mAo2gOPn10j214SH+HLYXj0cxN3wAvMBA/aGST7crd+Izo NT5VkivkmuJNvdd/amv6Hm62j6n2qMk3fEfnox5wba3HUzwWNr2kchJORDvOhl2qrI7U jabA== X-Gm-Message-State: APjAAAUtUkmiibZtYS380hnhFUb5KoO0mriSoJGJTP7wK7S45549pNWZ L9ZAM85vGKPT+YgjWCRB0MjmjAEM X-Google-Smtp-Source: APXvYqxYA54IEFn5i/FfoNSyMO9P4zWYC4G1jFk53MdmfBLIK0Jd+vmPUEAyHa2ZXP2Fq1hVkEsecw== X-Received: by 2002:adf:dc4a:: with SMTP id m10mr28625791wrj.0.1558002431194; Thu, 16 May 2019 03:27:11 -0700 (PDT) Received: from amir-ThinkPad-T480.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id d72sm4506299wmd.12.2019.05.16.03.27.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 May 2019 03:27:10 -0700 (PDT) From: Amir Goldstein To: Jan Kara Cc: Matthew Bobrowski , linux-fsdevel@vger.kernel.org Subject: [PATCH v2 14/14] fsnotify: get rid of fsnotify_nameremove() Date: Thu, 16 May 2019 13:26:41 +0300 Message-Id: <20190516102641.6574-15-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190516102641.6574-1-amir73il@gmail.com> References: <20190516102641.6574-1-amir73il@gmail.com> 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 For all callers of fsnotify_{unlink,rmdir}(), we made sure that d_parent and d_name are stable. Therefore, fsnotify_{unlink,rmdir}() do not need the safety measures in fsnotify_nameremove() to stabilize parent and name. We can now simplify those hooks and get rid of fsnotify_nameremove(). Signed-off-by: Amir Goldstein --- fs/notify/fsnotify.c | 41 -------------------------------- include/linux/fsnotify.h | 6 ++--- include/linux/fsnotify_backend.h | 4 ---- 3 files changed, 2 insertions(+), 49 deletions(-) diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c index 8c7cbac7183c..5433e37fb0c5 100644 --- a/fs/notify/fsnotify.c +++ b/fs/notify/fsnotify.c @@ -107,47 +107,6 @@ void fsnotify_sb_delete(struct super_block *sb) fsnotify_clear_marks_by_sb(sb); } -/* - * fsnotify_nameremove - a filename was removed from a directory - * - * This is mostly called under parent vfs inode lock so name and - * dentry->d_parent should be stable. However there are some corner cases where - * inode lock is not held. So to be on the safe side and be reselient to future - * callers and out of tree users of d_delete(), we do not assume that d_parent - * and d_name are stable and we use dget_parent() and - * take_dentry_name_snapshot() to grab stable references. - */ -void fsnotify_nameremove(struct dentry *dentry, int isdir) -{ - struct dentry *parent; - struct name_snapshot name; - __u32 mask = FS_DELETE; - - /* d_delete() of pseudo inode? (e.g. __ns_get_path() playing tricks) */ - if (IS_ROOT(dentry)) - return; - - if (isdir) - mask |= FS_ISDIR; - - parent = dget_parent(dentry); - /* Avoid unneeded take_dentry_name_snapshot() */ - if (!(d_inode(parent)->i_fsnotify_mask & FS_DELETE) && - !(dentry->d_sb->s_fsnotify_mask & FS_DELETE)) - goto out_dput; - - take_dentry_name_snapshot(&name, dentry); - - fsnotify(d_inode(parent), mask, d_inode(dentry), FSNOTIFY_EVENT_INODE, - &name.name, 0); - - release_dentry_name_snapshot(&name); - -out_dput: - dput(parent); -} -EXPORT_SYMBOL(fsnotify_nameremove); - /* * Given an inode, first check if we care what happens to our children. Inotify * and dnotify both tell their parents about events. If we care about any event diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index 0145073c2b42..a2d5d175d3c1 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h @@ -198,8 +198,7 @@ static inline void fsnotify_unlink(struct inode *dir, struct dentry *dentry) /* Expected to be called before d_delete() */ WARN_ON_ONCE(d_is_negative(dentry)); - /* TODO: call fsnotify_dirent() */ - fsnotify_nameremove(dentry, 0); + fsnotify_dirent(dir, dentry, FS_DELETE); } /* @@ -222,8 +221,7 @@ static inline void fsnotify_rmdir(struct inode *dir, struct dentry *dentry) /* Expected to be called before d_delete() */ WARN_ON_ONCE(d_is_negative(dentry)); - /* TODO: call fsnotify_dirent() */ - fsnotify_nameremove(dentry, 1); + fsnotify_dirent(dir, dentry, FS_DELETE | FS_ISDIR); } /* diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index a9f9dcc1e515..c28f6ed1f59b 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h @@ -355,7 +355,6 @@ extern int __fsnotify_parent(const struct path *path, struct dentry *dentry, __u extern void __fsnotify_inode_delete(struct inode *inode); extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt); extern void fsnotify_sb_delete(struct super_block *sb); -extern void fsnotify_nameremove(struct dentry *dentry, int isdir); extern u32 fsnotify_get_cookie(void); static inline int fsnotify_inode_watches_children(struct inode *inode) @@ -525,9 +524,6 @@ static inline void __fsnotify_vfsmount_delete(struct vfsmount *mnt) static inline void fsnotify_sb_delete(struct super_block *sb) {} -static inline void fsnotify_nameremove(struct dentry *dentry, int isdir) -{} - static inline void fsnotify_update_flags(struct dentry *dentry) {}