Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp8654918rwr; Thu, 11 May 2023 04:35:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7MUVvGsBQN0NlkhIBmbRqshVtFDvnFo8Xe9mLKHXBjYZeNY3iNUVP6Z4vdLTZI/ECIvemj X-Received: by 2002:a05:6a20:1590:b0:101:8601:467d with SMTP id h16-20020a056a20159000b001018601467dmr10121708pzj.36.1683804953378; Thu, 11 May 2023 04:35:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683804953; cv=none; d=google.com; s=arc-20160816; b=RrPrYWI8ZnNPyYeGOCUTH0T6Um9HL8jEdEB4mbSFylOGZi5AyRrp1Ib/LYaTS1q1zY ARlPZY1Cs3TlIOIOWye+FR50Y65IS1nP/8eMtPLUfCrwAFeuPGx06ulKr/OJa8RtiQqI VXg/htlScpDl3wnC61tXq3pUfcIMIaBq95qQ2ycxq1R2eM8bJ3OLRj1yWWlnD+RGdpsR +K0bihlrgLTyPn/FUobB42w9UMeKJl/uMp5Afle/7wIsRdgMg+IZ2t+Fo2frE1MJ7M4z 1irnRIsYjWC0gEwRDSUNYKhM6ucRcsbyMXhylPRHZhm10VWngj16c5fLe6Xph1fTDl3z +FDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=8UsFW/OKFLWzrfCHWAMRNvjMDP4f9tp8Nm34IOcM96Q=; b=j0XSiGf92MZXt383nJ2yd+11yskh6L2Pv0Nbj1Aoo6B+SaSn6U0nwzUanD0kkeY19g dVKx0vUny0aKxlkzJRvOXvrsv4giMI2SL/vrUmZB9AuUiMIeTPkCmQ/Z/yDBjk4reA/2 1yDHPToN5HePf/cguW/1kd2NJs7mxZAa1iPf6wqZoer3G/Vy9YZDtMGbcBeLvVan+kLN ee3BqkY2iRevmHuf/j3tzKMUamO5SkFmovub/KKegHfr7w/wgL23duN8X9gTjNFPrrIy IcPAdFN79pe0+Pjan4rQYLN1BYm1F3lU4/bO2utkXYMsuiA6GNWWQmq5uyemqXAkZelB KkAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Fna4hgvy; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x8-20020a17090a970800b002529da5faaesi419741pjo.58.2023.05.11.04.35.38; Thu, 11 May 2023 04:35:53 -0700 (PDT) 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=@linaro.org header.s=google header.b=Fna4hgvy; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237167AbjEKK41 (ORCPT + 99 others); Thu, 11 May 2023 06:56:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237899AbjEKK4X (ORCPT ); Thu, 11 May 2023 06:56:23 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A3985BB2 for ; Thu, 11 May 2023 03:56:19 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3f450815d0bso21730105e9.0 for ; Thu, 11 May 2023 03:56:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1683802578; x=1686394578; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=8UsFW/OKFLWzrfCHWAMRNvjMDP4f9tp8Nm34IOcM96Q=; b=Fna4hgvy4ayNdl2Mw7PgG9YfGLMggJPpJVbidjfaUama/51qz00nOGttQcvAWaDqwB u9TL2r8S9+R9piJxfwOCKdDBo4I0rl+Ed5PdQOtkqP6FxMxJU4kbkFqREqyQZff2cUrL NV5IEszFMo+s12cAjxzLlIRk2YUAF7UObDdWykNUzVMk//jNKVw1rEvGJapVQy9L6pJE IwzUs9NhPh6si5MlYEr+ftyW9jwY5vBqU0aNJ4vRsEEROKpIybncvu/FPLDQ8IYxHp7i 9kmw03xUvVfIuqGHL9tBm4LEU84SBmrla8GdQ+wyDwvwhRcCZ6GWuP5v0CSlquPlI+Bl FP/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683802578; x=1686394578; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8UsFW/OKFLWzrfCHWAMRNvjMDP4f9tp8Nm34IOcM96Q=; b=Ii6BMSrndDudUaTrgJmdz3fotN61Tx14ZVz7ZBwbYcpYn5Q4ilf0cjApxXTJ0feXAo wgTqv8IIg7IH/3l+p6lOqM1Ssk/nJPlpSkWGwSg/cxPfZ50FRGpBz7BngnQK//IwT3jI zhEluNOYzshBD0zUTR66dfIklHZUMlCt9mw3/NRRNsgWnT1IEGgG3yJT4xRx8UZ+vKH3 3DLbb9HHdH7ckNq7X4PoKTchmH4P3fkhfrQlwvRoN2c9hX1Pz8Nya6TqzOAtc56LPIyA o6rXUAcfOFjzQcMsw7IvnxYSg03UwjG5LRp8wku9zN+zWfK1fYdrbPAGY+J7bCAlwAJY ypuA== X-Gm-Message-State: AC+VfDwUKgRxFV2zIOwV+HRM0xayjyeecEZXE4AaLfxsSqQTTOhHTuAb eBj2piyMAFE9Of+Cx/oxkaYRTw== X-Received: by 2002:a05:600c:2047:b0:3f4:2452:9675 with SMTP id p7-20020a05600c204700b003f424529675mr9666596wmg.0.1683802577815; Thu, 11 May 2023 03:56:17 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id f5-20020adff985000000b002fda1b12a0bsm20319280wrr.2.2023.05.11.03.55.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 May 2023 03:56:15 -0700 (PDT) Date: Thu, 11 May 2023 13:55:57 +0300 From: Dan Carpenter To: oe-kbuild@lists.linux.dev, Dominique Martinet , Alexander Viro , Christian Brauner , Jens Axboe , Pavel Begunkov , Stefan Roesch Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev, Clay Harris , Dave Chinner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, io-uring@vger.kernel.org, Dominique Martinet Subject: Re: [PATCH v2 4/6] kernfs: implement readdir FMODE_NOWAIT Message-ID: <4e88ec58-be22-4b0c-968d-fa9a52764c98@kili.mountain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230422-uring-getdents-v2-4-2db1e37dc55e@codewreck.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Hi Dominique, kernel test robot noticed the following build warnings: url: https://github.com/intel-lab-lkp/linux/commits/Dominique-Martinet/fs-split-off-vfs_getdents-function-of-getdents64-syscall/20230510-185542 base: 58390c8ce1bddb6c623f62e7ed36383e7fa5c02f patch link: https://lore.kernel.org/r/20230422-uring-getdents-v2-4-2db1e37dc55e%40codewreck.org patch subject: [PATCH v2 4/6] kernfs: implement readdir FMODE_NOWAIT config: i386-randconfig-m021 (https://download.01.org/0day-ci/archive/20230511/202305110647.eSnSEulg-lkp@intel.com/config) compiler: gcc-11 (Debian 11.3.0-12) 11.3.0 If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot | Reported-by: Dan Carpenter | Link: https://lore.kernel.org/r/202305110647.eSnSEulg-lkp@intel.com/ smatch warnings: fs/kernfs/dir.c:1863 kernfs_fop_readdir() warn: inconsistent returns '&root->kernfs_rwsem'. vim +1863 fs/kernfs/dir.c c637b8acbe079e Tejun Heo 2013-12-11 1815 static int kernfs_fop_readdir(struct file *file, struct dir_context *ctx) fd7b9f7b9776b1 Tejun Heo 2013-11-28 1816 { fd7b9f7b9776b1 Tejun Heo 2013-11-28 1817 struct dentry *dentry = file->f_path.dentry; 319ba91d352a74 Shaohua Li 2017-07-12 1818 struct kernfs_node *parent = kernfs_dentry_node(dentry); 324a56e16e44ba Tejun Heo 2013-12-11 1819 struct kernfs_node *pos = file->private_data; 393c3714081a53 Minchan Kim 2021-11-18 1820 struct kernfs_root *root; fd7b9f7b9776b1 Tejun Heo 2013-11-28 1821 const void *ns = NULL; fd7b9f7b9776b1 Tejun Heo 2013-11-28 1822 fd7b9f7b9776b1 Tejun Heo 2013-11-28 1823 if (!dir_emit_dots(file, ctx)) fd7b9f7b9776b1 Tejun Heo 2013-11-28 1824 return 0; 393c3714081a53 Minchan Kim 2021-11-18 1825 393c3714081a53 Minchan Kim 2021-11-18 1826 root = kernfs_root(parent); a551138c4b3b9f Dominique Martinet 2023-05-10 1827 if (ctx->flags & DIR_CONTEXT_F_NOWAIT) { a551138c4b3b9f Dominique Martinet 2023-05-10 1828 if (!down_read_trylock(&root->kernfs_rwsem)) a551138c4b3b9f Dominique Martinet 2023-05-10 1829 return -EAGAIN; a551138c4b3b9f Dominique Martinet 2023-05-10 1830 } else { 393c3714081a53 Minchan Kim 2021-11-18 1831 down_read(&root->kernfs_rwsem); a551138c4b3b9f Dominique Martinet 2023-05-10 1832 } fd7b9f7b9776b1 Tejun Heo 2013-11-28 1833 324a56e16e44ba Tejun Heo 2013-12-11 1834 if (kernfs_ns_enabled(parent)) c525aaddc366df Tejun Heo 2013-12-11 1835 ns = kernfs_info(dentry->d_sb)->ns; fd7b9f7b9776b1 Tejun Heo 2013-11-28 1836 c637b8acbe079e Tejun Heo 2013-12-11 1837 for (pos = kernfs_dir_pos(ns, parent, ctx->pos, pos); fd7b9f7b9776b1 Tejun Heo 2013-11-28 1838 pos; c637b8acbe079e Tejun Heo 2013-12-11 1839 pos = kernfs_dir_next_pos(ns, parent, ctx->pos, pos)) { adc5e8b58f4886 Tejun Heo 2013-12-11 1840 const char *name = pos->name; 364595a6851bf6 Jeff Layton 2023-03-30 1841 unsigned int type = fs_umode_to_dtype(pos->mode); fd7b9f7b9776b1 Tejun Heo 2013-11-28 1842 int len = strlen(name); 67c0496e87d193 Tejun Heo 2019-11-04 1843 ino_t ino = kernfs_ino(pos); fd7b9f7b9776b1 Tejun Heo 2013-11-28 1844 adc5e8b58f4886 Tejun Heo 2013-12-11 1845 ctx->pos = pos->hash; fd7b9f7b9776b1 Tejun Heo 2013-11-28 1846 file->private_data = pos; fd7b9f7b9776b1 Tejun Heo 2013-11-28 1847 kernfs_get(pos); fd7b9f7b9776b1 Tejun Heo 2013-11-28 1848 393c3714081a53 Minchan Kim 2021-11-18 1849 up_read(&root->kernfs_rwsem); fd7b9f7b9776b1 Tejun Heo 2013-11-28 1850 if (!dir_emit(ctx, name, len, ino, type)) fd7b9f7b9776b1 Tejun Heo 2013-11-28 1851 return 0; 393c3714081a53 Minchan Kim 2021-11-18 1852 down_read(&root->kernfs_rwsem); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Needs to be deleted. a551138c4b3b9f Dominique Martinet 2023-05-10 1853 if (ctx->flags & DIR_CONTEXT_F_NOWAIT) { a551138c4b3b9f Dominique Martinet 2023-05-10 1854 if (!down_read_trylock(&root->kernfs_rwsem)) a551138c4b3b9f Dominique Martinet 2023-05-10 1855 return 0; It's a bit strange the this doesn't return -EAGAIN; a551138c4b3b9f Dominique Martinet 2023-05-10 1856 } else { a551138c4b3b9f Dominique Martinet 2023-05-10 1857 down_read(&root->kernfs_rwsem); a551138c4b3b9f Dominique Martinet 2023-05-10 1858 } fd7b9f7b9776b1 Tejun Heo 2013-11-28 1859 } 393c3714081a53 Minchan Kim 2021-11-18 1860 up_read(&root->kernfs_rwsem); fd7b9f7b9776b1 Tejun Heo 2013-11-28 1861 file->private_data = NULL; fd7b9f7b9776b1 Tejun Heo 2013-11-28 1862 ctx->pos = INT_MAX; fd7b9f7b9776b1 Tejun Heo 2013-11-28 @1863 return 0; fd7b9f7b9776b1 Tejun Heo 2013-11-28 1864 } -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests