Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3419149yba; Tue, 16 Apr 2019 10:56:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqyN6Ni53Sp2xbn6MZoGLyXssF86KXjYCqunLcRDaJ7eYMJ0ce323KJXrduJbBjp+kYePEet X-Received: by 2002:a17:902:24a2:: with SMTP id w31mr51042833pla.78.1555437381515; Tue, 16 Apr 2019 10:56:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555437381; cv=none; d=google.com; s=arc-20160816; b=giSWpCc4vX4gpqjl2Vc/gsvuAV+L+0Od2UBGpsK8Q/qPtWr42tZR1t96eBbKiHqPjU 0m6syH73oBHduOewhVTwslJuyx4mkh2z4oOMhp7kn1wl4v3WCIgK6YXWrAlbX7fr2s5c YjLPY7/XyBk9xS64iu188DH1JlYlODfvTkcD5GsXv8VylWG8jCAXtqPHA1vl/Gk5yOQB fkozJVv7ubfijHvwJ7daB19wzGHykQG9voI2cFy3OCC0DQXIJYnrzVmm9kFHcM0+NlqI R2h8+MXOgiMZ3MpqhJkW99oXvTP2fsozG/EO4L3WgHNyJWthJDITUdOHcc/pbDOeCdRE 2l0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=sRdFVBBBDU7FUQxJBuo49m7zcfKyK9Ss8i9+ZNRmj24=; b=H+CjUgY2/qiRE6AC8jHw82c8i/fN3IvIzaybhAMyCsx/NfzrrJWiP0gjmYjnLm9PDq spVZ4sg2T/SPgYamn67pKD+VCatLA2x2DfdfB0WhOxkfTMc94Ez76qosYtlBldCLKCS/ Lj6RY6ZePqTaDlkyY8I8FYxRTuc+pXMREigf+C3WFLuR6XUrQYhGY1LzNfou621r7Hgl P/oXdp+zK1YOTXUy4hhV7UuuPx3ShuGGU6TNEHvnkXRpkhrrDBl6esseDZAaLYY1OzTO 1VSmjcvgdxCl6g4Iafmq2riOBAOb8tZ57HnI4a0CJkcDwTqsGBl4ffNvKMtmvFfnc1dp hhvQ== 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 h66si24474567pgc.418.2019.04.16.10.56.05; Tue, 16 Apr 2019 10:56:21 -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 S1730623AbfDPRy5 (ORCPT + 99 others); Tue, 16 Apr 2019 13:54:57 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:57702 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730356AbfDPRxu (ORCPT ); Tue, 16 Apr 2019 13:53:50 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92 #3 (Red Hat Linux)) id 1hGSHE-0005Zz-C5; Tue, 16 Apr 2019 17:53:48 +0000 From: Al Viro To: Linus Torvalds Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 55/62] fuse: switch to ->free_inode() Date: Tue, 16 Apr 2019 18:53:33 +0100 Message-Id: <20190416175340.21068-55-viro@ZenIV.linux.org.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190416175340.21068-1-viro@ZenIV.linux.org.uk> References: <20190416174900.GT2217@ZenIV.linux.org.uk> <20190416175340.21068-1-viro@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro fuse_destroy_inode() is gone - sanity checks that need the stack trace of the caller get moved into ->evict_inode(), the rest joins the RCU-delayed part which becomes ->free_inode(). While we are at it, don't just pass the address of what happens to be the first member of structure to kmem_cache_free() - get_fuse_inode() is there for purpose and it gives the proper container_of() use. No behaviour change, but verifying correctness is easier that way. Signed-off-by: Al Viro --- fs/fuse/inode.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index ec5d9953dfb6..f485d09d14df 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -107,34 +107,30 @@ static struct inode *fuse_alloc_inode(struct super_block *sb) return inode; } -static void fuse_i_callback(struct rcu_head *head) -{ - struct inode *inode = container_of(head, struct inode, i_rcu); - kmem_cache_free(fuse_inode_cachep, inode); -} - -static void fuse_destroy_inode(struct inode *inode) +static void fuse_free_inode(struct inode *inode) { struct fuse_inode *fi = get_fuse_inode(inode); - if (S_ISREG(inode->i_mode) && !is_bad_inode(inode)) { - WARN_ON(!list_empty(&fi->write_files)); - WARN_ON(!list_empty(&fi->queued_writes)); - } + mutex_destroy(&fi->mutex); kfree(fi->forget); - call_rcu(&inode->i_rcu, fuse_i_callback); + kmem_cache_free(fuse_inode_cachep, fi); } static void fuse_evict_inode(struct inode *inode) { + struct fuse_inode *fi = get_fuse_inode(inode); + truncate_inode_pages_final(&inode->i_data); clear_inode(inode); if (inode->i_sb->s_flags & SB_ACTIVE) { struct fuse_conn *fc = get_fuse_conn(inode); - struct fuse_inode *fi = get_fuse_inode(inode); fuse_queue_forget(fc, fi->forget, fi->nodeid, fi->nlookup); fi->forget = NULL; } + if (S_ISREG(inode->i_mode) && !is_bad_inode(inode)) { + WARN_ON(!list_empty(&fi->write_files)); + WARN_ON(!list_empty(&fi->queued_writes)); + } } static int fuse_remount_fs(struct super_block *sb, int *flags, char *data) @@ -814,7 +810,7 @@ static const struct export_operations fuse_export_operations = { static const struct super_operations fuse_super_operations = { .alloc_inode = fuse_alloc_inode, - .destroy_inode = fuse_destroy_inode, + .free_inode = fuse_free_inode, .evict_inode = fuse_evict_inode, .write_inode = fuse_write_inode, .drop_inode = generic_delete_inode, -- 2.11.0