From patchwork Tue Jan 24 02:38:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Van Hensbergen X-Patchwork-Id: 47498 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1931182wrn; Mon, 23 Jan 2023 18:41:47 -0800 (PST) X-Google-Smtp-Source: AMrXdXv3Z+XKWIbbOCVjOIA+GCCRnJfFSnUR52PV6jNXzcTiQwtuQrUASV9nz7SdoFTLKMzbgtww X-Received: by 2002:a17:906:f0d1:b0:84d:450b:8767 with SMTP id dk17-20020a170906f0d100b0084d450b8767mr27667368ejb.21.1674528107462; Mon, 23 Jan 2023 18:41:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674528107; cv=none; d=google.com; s=arc-20160816; b=T4VQN0jIn7mjyBPmIjDS+jheJqLK3p49yduGA7OLlKCITGfgwpENXxbzpbSnaV+Enb VMmAHq2bMraYDSnRD7SMBLLuOrp1gR+CzifOteqVmn29gvEvJdXN4jD4GlMT/yNbLdfa adzksXldee6igYe8Q/Tk+hxX9USTyKpcpPrTD686NP6AjaTpsxIR0LjvOAIA0dymiYQG lqXg26ATD4YxP4aAiP5icgijYbC0T7pPesqwHpt5HmlHhjP9+fLFecvRXvCf13N7AjBd /9seQUM4GwGFxa1Ag5tozGgZYSW0xvrS7CHc8+dFEZZQZV4etWN7UvjSa61OLZ4aWquO d2Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zT9nZJtxsSGPA6mnzH8BveEcwqkVk9oV65w77lNRJzs=; b=PNv/nwTvdpDrhi36I/Zs5d6rHO7/j/S19AEB3UU+wPqRJvUUsfiUfv06xET+rYHVmT 8ZqXghASWllrtFsdwdrO2sLYWdqFaSQcLhJdW1Ccw0GkdtV90SA7ZU96LK3g2fQ6doVg wuWip29iQpKi9F3h/nnqw12TWEbpcyUzuhBED/5xR6mEjtF5SVIA3pQBEnj2mJSzRTT8 TSisjSd32EECIpeNYsOxznuYEuUg91JpYctz8FvTOjfU16Z/p4QClhdjWjdaEri4odUK 5t0dos0hQQHj0z98f5wLEevFGeVOHXGcm0PTDFmPG8sU9QB3d5YPART3kft2xKYB9EfL U+fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KjuSU3LL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g41-20020a056402322900b0049e1782c0e8si1543821eda.491.2023.01.23.18.41.24; Mon, 23 Jan 2023 18:41:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KjuSU3LL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232719AbjAXCju (ORCPT + 99 others); Mon, 23 Jan 2023 21:39:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232462AbjAXCj1 (ORCPT ); Mon, 23 Jan 2023 21:39:27 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A8FE39B92; Mon, 23 Jan 2023 18:39:18 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C8F15611AD; Tue, 24 Jan 2023 02:39:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B34EC433D2; Tue, 24 Jan 2023 02:39:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674527957; bh=R35j7a+A+ua085wQYKH/cW9sDjYEKNr2+kfZb69JhNI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KjuSU3LLv3roUT4HD9fauR5bsdtCKyfG+axelFxmkk0jDaF0HQ4pmtlJw8rSD74No iMEUaZq8iUc4aTdDjrDuloUmHBsRa6P1JL2hFSjqs0JuxiL6omywGX21yM0Lj/X13q AcmwBVePcIYTNTWDiCkKpN67hdUfhpmEHRCoo1VAoTYQdtN4GrND6AvnExd7qJX87n osdbPjVC2z282cSYLx6pHziImBeqKDwt07VwLtguvFa6R/HRlIDUB9d52pPh28nzlt ncrbxibS4n8C5E1O3kanhwWQuVGEyTRTpa+/ojg/g32ILEVLLCojOkjr9ad24NWkYh b9fcpNiWFXAvA== From: Eric Van Hensbergen To: v9fs-developer@lists.sourceforge.net, asmadeus@codewreck.org, rminnich@gmail.com, lucho@ionkov.net Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux_oss@crudebyte.com, Eric Van Hensbergen Subject: [PATCH v3 09/11] fix error reporting in v9fs_dir_release Date: Tue, 24 Jan 2023 02:38:32 +0000 Message-Id: <20230124023834.106339-10-ericvh@kernel.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230124023834.106339-1-ericvh@kernel.org> References: <20221218232217.1713283-1-evanhensbergen@icloud.com> <20230124023834.106339-1-ericvh@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752596234981013814?= X-GMAIL-MSGID: =?utf-8?q?1755869984727278883?= Checking the p9_fid_put value allows us to pass back errors involved if we end up clunking the fid as part of dir_release. This can help with more graceful response to errors in writeback among other things. Signed-off-by: Eric Van Hensbergen --- fs/9p/vfs_dir.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c index ec831c27a58e..1fc07bb86e6f 100644 --- a/fs/9p/vfs_dir.c +++ b/fs/9p/vfs_dir.c @@ -197,7 +197,7 @@ static int v9fs_dir_readdir_dotl(struct file *file, struct dir_context *ctx) /** - * v9fs_dir_release - close a directory + * v9fs_dir_release - called on a close of a file or directory * @inode: inode of the directory * @filp: file pointer to a directory * @@ -209,6 +209,7 @@ int v9fs_dir_release(struct inode *inode, struct file *filp) struct p9_fid *fid; __le32 version; loff_t i_size; + int retval = 0; fid = filp->private_data; p9_debug(P9_DEBUG_VFS, "inode: %p filp: %p fid: %d\n", @@ -226,7 +227,7 @@ int v9fs_dir_release(struct inode *inode, struct file *filp) spin_lock(&inode->i_lock); hlist_del(&fid->ilist); spin_unlock(&inode->i_lock); - p9_fid_put(fid); + retval = p9_fid_put(fid); } if ((filp->f_mode & FMODE_WRITE)) { @@ -237,7 +238,7 @@ int v9fs_dir_release(struct inode *inode, struct file *filp) } else { fscache_unuse_cookie(v9fs_inode_cookie(v9inode), NULL, NULL); } - return 0; + return retval; } const struct file_operations v9fs_dir_operations = {