Message ID | 20231023093359.64265-1-raven@themaw.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1175295vqx; Mon, 23 Oct 2023 02:35:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH0LT0yFn65qPun77mXK/372JVrYLpeUO0DPZwwk/fLYJs+L5rlBfkwVTFYFxYAQt6VQzIv X-Received: by 2002:a17:90b:4b12:b0:27d:2663:c5f4 with SMTP id lx18-20020a17090b4b1200b0027d2663c5f4mr9398032pjb.47.1698053751305; Mon, 23 Oct 2023 02:35:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698053751; cv=none; d=google.com; s=arc-20160816; b=f7/2ZXCG24SpNOHCew59y+iGI+Nxe8HuOvHjjKYpbtx4RQL+1ZOFUn4pP7xbf4qmkQ 62av5yY9/syu+GXiLXfXU4RNWcd9YFZArN2D/TFYmYMdveErQ5zt7i+vnMcz6W6NpG6v LB97iy4kLN2bs2wfSZ4W2EhlcauwVLpirk0ixJrJyQweqr2LqpCE36S3mrz8N+Z6dPQo n0g1mUeTvsO87CmMGGooMUPnL1CmuXMn6tgFFOpjl/xLMzhOSMrKB8yNW1CgPdFdbOz2 7xQxMP9ru5+UQZjtwzJLbFy91Bj8N73Qe6Xe6Op0yfGT5YW71z03i2wok9JkZuog1v5T Lc1A== 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 :message-id:date:subject:cc:to:from; bh=TYFiOYEohrDzmqisFqeaJwXSZn4cv70zpQwC+z60tgw=; fh=xgk2BkB9u/EUNGJsk/8C7j+FM8iDpdjhcjc/uZVA4YY=; b=ty6RecaYRtbN3O1EOfSZLzSVAh2S+4geWcWW1nzVtk7Inp6JPsHilKjLkZwXfXdMXB hODmRfuEBbtARP/dPXqrSN0OubOtj7Ty2RtAi17+bOEPJWoQzaW67RxGFuJEQKbsgVPs Sv+e/r6xj9CsAri55kFTUWWlWrP2jYEoILkpHu6CNpu82BVdZ+66o9osvN64P13OjIJB GAlaQqiM4efcnxGlsDgD9IkkPpr6qqCruHrWgBXuFeXnuB5s+yTobuTo1aEGWTMcWUdD 3y839zA4mGo1OYdMjcLrnxZSCASb/8uQeKmalAsHwyBYlyccjHWbR+4sgBwBvN718SsN AaXQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id 33-20020a17090a09a400b002768cfbe6desi8877969pjo.112.2023.10.23.02.35.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 02:35:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 6B8CA809FA6A; Mon, 23 Oct 2023 02:35:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229575AbjJWJfR (ORCPT <rfc822;aposhian.dev@gmail.com> + 27 others); Mon, 23 Oct 2023 05:35:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233242AbjJWJfD (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 23 Oct 2023 05:35:03 -0400 Received: from smtp02.aussiebb.com.au (smtp02.aussiebb.com.au [IPv6:2403:5800:3:25::1002]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B18E41722; Mon, 23 Oct 2023 02:34:24 -0700 (PDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp02.aussiebb.com.au (Postfix) with ESMTP id 387E710181C; Mon, 23 Oct 2023 20:34:17 +1100 (AEDT) X-Virus-Scanned: Debian amavisd-new at smtp02.aussiebb.com.au Received: from smtp02.aussiebb.com.au ([127.0.0.1]) by localhost (smtp02.aussiebb.com.au [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RmsSVixHbriO; Mon, 23 Oct 2023 20:34:17 +1100 (AEDT) Received: by smtp02.aussiebb.com.au (Postfix, from userid 116) id 2E13F1026C5; Mon, 23 Oct 2023 20:34:17 +1100 (AEDT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from donald.themaw.com (159-196-82-144.9fc452.per.static.aussiebb.net [159.196.82.144]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: ian146@aussiebb.com.au) by smtp02.aussiebb.com.au (Postfix) with ESMTPSA id F363910181C; Mon, 23 Oct 2023 20:34:14 +1100 (AEDT) From: Ian Kent <raven@themaw.net> To: Arnd Bergmann <arnd@arndb.de>, Anders Roxell <anders.roxell@linaro.org>, Dan Carpenter <dan.carpenter@linaro.org>, Christian Brauner <brauner@kernel.org> Cc: Naresh Kamboju <naresh.kamboju@linaro.org>, Bill O'Donnell <bodonnel@redhat.com>, Kernel Mailing List <linux-kernel@vger.kernel.org>, autofs mailing list <autofs@vger.kernel.org>, linux-fsdevel <linux-fsdevel@vger.kernel.org>, Ian Kent <raven@themaw.net>, lkft-triage@lists.linaro.org, Stephen Rothwell <sfr@canb.auug.org.au>, Linux Kernel Functional Testing <lkft@linaro.org> Subject: [PATCH] autofs: fix add autofs_parse_fd() Date: Mon, 23 Oct 2023 17:33:59 +0800 Message-ID: <20231023093359.64265-1-raven@themaw.net> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 23 Oct 2023 02:35:48 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780538410254186399 X-GMAIL-MSGID: 1780538410254186399 |
Series |
autofs: fix add autofs_parse_fd()
|
|
Commit Message
Ian Kent
Oct. 23, 2023, 9:33 a.m. UTC
We are seeing systemd hang on its autofs direct mount at
/proc/sys/fs/binfmt_misc.
Historically this was due to a mismatch in the communication structure
size between a 64 bit kernel and a 32 bit user space and was fixed by
making the pipe communication record oriented.
During autofs v5 development I decided to stay with the existing usage
instead of changing to a packed structure for autofs <=> user space
communications which turned out to be a mistake on my part.
Problems arose and they were fixed by allowing for the 64 bit to 32
bit size difference in the automount(8) code.
Along the way systemd started to use autofs and eventually encountered
this problem too. systemd refused to compensate for the length
difference insisting it be fixed in the kernel. Fortunately Linus
implemented the packetized pipe which resolved the problem in a
straight forward and simple way.
In the autofs mount api conversion series I inadvertatly dropped the
packet pipe flag settings when adding the autofs_parse_fd() function.
This patch fixes that omission.
Fixes: 546694b8f658 ("autofs: add autofs_parse_fd()")
Signed-off-by: Ian Kent <raven@themaw.net>
Cc: Bill O'Donnell <bodonnel@redhat.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Anders Roxell <anders.roxell@linaro.org>
Cc: Naresh Kamboju <naresh.kamboju@linaro.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
Reported-by: Anders Roxell <anders.roxell@linaro.org>
---
fs/autofs/autofs_i.h | 13 +++++++++----
fs/autofs/inode.c | 2 ++
2 files changed, 11 insertions(+), 4 deletions(-)
Comments
On Mon, 23 Oct 2023 at 11:34, Ian Kent <raven@themaw.net> wrote: > > We are seeing systemd hang on its autofs direct mount at > /proc/sys/fs/binfmt_misc. > > Historically this was due to a mismatch in the communication structure > size between a 64 bit kernel and a 32 bit user space and was fixed by > making the pipe communication record oriented. > > During autofs v5 development I decided to stay with the existing usage > instead of changing to a packed structure for autofs <=> user space > communications which turned out to be a mistake on my part. > > Problems arose and they were fixed by allowing for the 64 bit to 32 > bit size difference in the automount(8) code. > > Along the way systemd started to use autofs and eventually encountered > this problem too. systemd refused to compensate for the length > difference insisting it be fixed in the kernel. Fortunately Linus > implemented the packetized pipe which resolved the problem in a > straight forward and simple way. > > In the autofs mount api conversion series I inadvertatly dropped the > packet pipe flag settings when adding the autofs_parse_fd() function. > This patch fixes that omission. > > Fixes: 546694b8f658 ("autofs: add autofs_parse_fd()") > Signed-off-by: Ian Kent <raven@themaw.net> > Cc: Bill O'Donnell <bodonnel@redhat.com> > Cc: Christian Brauner <brauner@kernel.org> > Cc: Arnd Bergmann <arnd@arndb.de> > Cc: Dan Carpenter <dan.carpenter@linaro.org> > Cc: Anders Roxell <anders.roxell@linaro.org> > Cc: Naresh Kamboju <naresh.kamboju@linaro.org> > Cc: Stephen Rothwell <sfr@canb.auug.org.au> > Reported-by: Linux Kernel Functional Testing <lkft@linaro.org> > Reported-by: Anders Roxell <anders.roxell@linaro.org> Thank you Ian for finding the issue so quickly. Tested-by: Anders Roxell <anders.roxell@linaro.org> I built todays next-20231023 with this patch and the kernel booted up fine in qemu. Cheers, Anders > --- > fs/autofs/autofs_i.h | 13 +++++++++---- > fs/autofs/inode.c | 2 ++ > 2 files changed, 11 insertions(+), 4 deletions(-) > > diff --git a/fs/autofs/autofs_i.h b/fs/autofs/autofs_i.h > index 244f18cdf23c..8c1d587b3eef 100644 > --- a/fs/autofs/autofs_i.h > +++ b/fs/autofs/autofs_i.h > @@ -221,15 +221,20 @@ static inline int autofs_check_pipe(struct file *pipe) > return 0; > } > > -static inline int autofs_prepare_pipe(struct file *pipe) > +static inline void autofs_set_packet_pipe_flags(struct file *pipe) > { > - int ret = autofs_check_pipe(pipe); > - if (ret < 0) > - return ret; > /* We want a packet pipe */ > pipe->f_flags |= O_DIRECT; > /* We don't expect -EAGAIN */ > pipe->f_flags &= ~O_NONBLOCK; > +} > + > +static inline int autofs_prepare_pipe(struct file *pipe) > +{ > + int ret = autofs_check_pipe(pipe); > + if (ret < 0) > + return ret; > + autofs_set_packet_pipe_flags(pipe); > return 0; > } > > diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c > index 6d2e01c9057d..a3d62acc293a 100644 > --- a/fs/autofs/inode.c > +++ b/fs/autofs/inode.c > @@ -177,6 +177,8 @@ static int autofs_parse_fd(struct fs_context *fc, struct autofs_sb_info *sbi, > return -EBADF; > } > > + autofs_set_packet_pipe_flags(pipe); > + > if (sbi->pipe) > fput(sbi->pipe); > > -- > 2.41.0 >
On Mon, 23 Oct 2023 17:33:59 +0800, Ian Kent wrote: > We are seeing systemd hang on its autofs direct mount at > /proc/sys/fs/binfmt_misc. > > Historically this was due to a mismatch in the communication structure > size between a 64 bit kernel and a 32 bit user space and was fixed by > making the pipe communication record oriented. > > [...] Thanks for the fix! --- Applied to the vfs.autofs branch of the vfs/vfs.git tree. Patches in the vfs.autofs branch should appear in linux-next soon. Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it. It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated. Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch. tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs.autofs [1/1] autofs: fix add autofs_parse_fd() https://git.kernel.org/vfs/vfs/c/d3c50061765d
diff --git a/fs/autofs/autofs_i.h b/fs/autofs/autofs_i.h index 244f18cdf23c..8c1d587b3eef 100644 --- a/fs/autofs/autofs_i.h +++ b/fs/autofs/autofs_i.h @@ -221,15 +221,20 @@ static inline int autofs_check_pipe(struct file *pipe) return 0; } -static inline int autofs_prepare_pipe(struct file *pipe) +static inline void autofs_set_packet_pipe_flags(struct file *pipe) { - int ret = autofs_check_pipe(pipe); - if (ret < 0) - return ret; /* We want a packet pipe */ pipe->f_flags |= O_DIRECT; /* We don't expect -EAGAIN */ pipe->f_flags &= ~O_NONBLOCK; +} + +static inline int autofs_prepare_pipe(struct file *pipe) +{ + int ret = autofs_check_pipe(pipe); + if (ret < 0) + return ret; + autofs_set_packet_pipe_flags(pipe); return 0; } diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c index 6d2e01c9057d..a3d62acc293a 100644 --- a/fs/autofs/inode.c +++ b/fs/autofs/inode.c @@ -177,6 +177,8 @@ static int autofs_parse_fd(struct fs_context *fc, struct autofs_sb_info *sbi, return -EBADF; } + autofs_set_packet_pipe_flags(pipe); + if (sbi->pipe) fput(sbi->pipe);