Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1235665rda; Mon, 23 Oct 2023 06:48:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEt/VhQqeO+Uuizbsrf8cs3CavE4oO6IbgQmMrIYT117oO3eax0blSyPTY/JMhoSp1PGKum X-Received: by 2002:a17:90a:7047:b0:27c:df02:88b3 with SMTP id f65-20020a17090a704700b0027cdf0288b3mr13344847pjk.8.1698068918301; Mon, 23 Oct 2023 06:48:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698068918; cv=none; d=google.com; s=arc-20160816; b=UWWUw5L2IgD8ZoHAUhSew0b1ZTRAX/Uuw31kh1Lmgmjwl0wjO0c/bFNFQBJWnWVvnm 25jsf+A9vXb/w878shmPQFc419yypYBNByHMdRXvpyNiHopQGdwGDtowvoXqYeADcko0 DQrbMgKINvaw4mc3/JElPMSsbKP3CjZjbAUbF/BaXP9JtwhLlvF3mWKVEm9qH/u/G9jv snedeK8YqT1MWGmvZXe+zFQChHCuLgCh3XU8D77xY9iqZ4Tus337iirUMLHUXkpTQnrn QiM4rCC0ufkp4IK7o5kKreIlmAQTZ8MoqV+OgjAGjQiGLkARSKdGj59Ria+BLV7q0zKy ZjGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=KNoz4gqx6N/ZXGBPCPNo+bBkQqfT+ZPW+a7bpLJE35w=; fh=0W8+ubEb7AKLu37EqaTr7KMRTY3ZKcuHyqg/+n57OSc=; b=bzR5vBYVUUaBbmWBcmDmTPnDxgDILtmhPuGJQnOV7eMIimV76Z26HsTFdfAkyKIPWI UOAJ+OS94A3HiEnz3R8aXr9i3XCIxYbqskFATBzwaYyaU0Nx6cikRMUd+c8IemqXoRnA r9Fx6IMDa7fBejw2zvN5PAHbrFieVULTJMAfn+ulABASuJ/zcWSLBbv2+Q14cQHCVO6f F1HF/dbhXsiCKz8y+7bxg/2BF2nPq9quaNMCht691zI7D9f5wQ539ir9CUsLe83htHhD ZuQDoHrbvaQtSqS5y0wYZicHyLjPgrcKCNrqMoAhCDpXKQcis4MoqM9bUftWy9AMuepu qBpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UJSw6Mcw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id j11-20020a17090a94cb00b00278f5fad9b6si9072648pjw.139.2023.10.23.06.48.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 06:48:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UJSw6Mcw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id E2CB9803E9F8; Mon, 23 Oct 2023 06:48:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229865AbjJWNsa (ORCPT + 99 others); Mon, 23 Oct 2023 09:48:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229807AbjJWNs3 (ORCPT ); Mon, 23 Oct 2023 09:48:29 -0400 Received: from mail-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AFBCE5 for ; Mon, 23 Oct 2023 06:48:26 -0700 (PDT) Received: by mail-qk1-x733.google.com with SMTP id af79cd13be357-778a108ae49so327428585a.0 for ; Mon, 23 Oct 2023 06:48:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698068905; x=1698673705; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=KNoz4gqx6N/ZXGBPCPNo+bBkQqfT+ZPW+a7bpLJE35w=; b=UJSw6Mcw62jh/s1zkxr7/9iuQsLrWiAULzc5ytt0fIRDBRrmEAyXz3OBk88wulgreg jnki3OrSIR6y/ryG76Nw3W6TBkNHzVGQnmbU5ezXKOQRXO512n6HJcFf5f16q7J28ZkR dAidy6BR9jo+6tx18Jf/0i1PqIHj6UUcFyzO0x3b2m4HszqGk6BrK6mv7o8gMwohJHCa YQlQsBrYNFHGvdln4LCIzpI/H28qmma6TNXLZIk/pr1jU2vOhByV8GrSbejS51/UT5sa 1h40RyIRaYo6cL48cROkPWvVyIlKDQaZviMOlC0KTLbWLNgB7yn4CtG5JFTfW6Nnpiic ZxOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698068905; x=1698673705; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KNoz4gqx6N/ZXGBPCPNo+bBkQqfT+ZPW+a7bpLJE35w=; b=CmSAvvm0sRpZ64koCffhLcimtYbToe88XGMunRPjhMj1oDJL4ph1pQ23YEdHWMdmpO zp+pCwu6LZchXRBo9PzxGzpiNpnSD0lqtvkvB1PDxiMgT6+lKK7sPGvknWwIn9ki2UPX Etn5UXz8lABZNRRaMJE0QgxomGjKi92h8KW6PldcIccb5lTvESaSsA5L+5voDj+zk+ij zsLtvr8pWy2XFUaA8OycWTbcwaZHdREkD/Vq1ssnKpRLVy3hz4nR3+pWGGPj6pB6NVwT JeETG51YCGj9Vz34wCRiK7TAj71HI7xo/DquFt2bDgXs2UXJTPnvNKYiEYw/aXdewoxX +TBg== X-Gm-Message-State: AOJu0Ywu441uYphqCFDUvvuJNgWT3dLcJQO9qWDobZm+ZHP2UdESOruU iMKzJ4t7SiNxhmTsDV6f2rjumlvGRkdUKg1LHXj6gA== X-Received: by 2002:a05:6214:18ec:b0:66d:593e:7722 with SMTP id ep12-20020a05621418ec00b0066d593e7722mr17263102qvb.3.1698068905368; Mon, 23 Oct 2023 06:48:25 -0700 (PDT) MIME-Version: 1.0 References: <20231023093359.64265-1-raven@themaw.net> In-Reply-To: <20231023093359.64265-1-raven@themaw.net> From: Anders Roxell Date: Mon, 23 Oct 2023 15:48:14 +0200 Message-ID: Subject: Re: [PATCH] autofs: fix add autofs_parse_fd() To: Ian Kent Cc: Arnd Bergmann , Dan Carpenter , Christian Brauner , Naresh Kamboju , "Bill O'Donnell" , Kernel Mailing List , autofs mailing list , linux-fsdevel , lkft-triage@lists.linaro.org, Stephen Rothwell , Linux Kernel Functional Testing Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 23 Oct 2023 06:48:36 -0700 (PDT) On Mon, 23 Oct 2023 at 11:34, 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. > > 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 > Cc: Bill O'Donnell > Cc: Christian Brauner > Cc: Arnd Bergmann > Cc: Dan Carpenter > Cc: Anders Roxell > Cc: Naresh Kamboju > Cc: Stephen Rothwell > Reported-by: Linux Kernel Functional Testing > Reported-by: Anders Roxell Thank you Ian for finding the issue so quickly. Tested-by: Anders Roxell 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 >