Received: by 10.223.185.116 with SMTP id b49csp823938wrg; Sat, 10 Feb 2018 21:14:58 -0800 (PST) X-Google-Smtp-Source: AH8x227tHxuHygWBAPUQ3SRWIRyimaD61sxXDBvUWYEQNaL1HJ+dgKMc1D+PUYOKASA1tMq/FrCN X-Received: by 2002:a17:902:223:: with SMTP id 32-v6mr7405593plc.77.1518326098635; Sat, 10 Feb 2018 21:14:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518326098; cv=none; d=google.com; s=arc-20160816; b=elAJ9QWVqheQVQ0+2191C3mnaEBDo3Sj14/zy73rW8Sza+3gXJ4LMKbmnc9F+xktyd Ff/xdGkVXKShfMy4xhaHcl8G4BoMNdf0EQeuyz2nOSYT0hTUSDHlyTh3RdcBQR5i0a6i /RT1yCe92UkMXgyz/fzOaf1T81h5aLvebOiZ1SdkWJetVsiA5yTJGdU5+ilwzUrpuBmX AGA+T+wFhO8K/nZSq2aad9DTB6B0vU786KyNoWhyKKgMjb7nY6StTN+mlmr+73869UQ5 GHflSLIyPefH7k4mw2LW7FovuhQr5ggB/7T4K+npwvizh3NjOGLwFKo69+35FCd31bD7 C5sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=y0mZqfPUiAZ+upshjlpNiQr3t3cARq973qsUUedzfFI=; b=g81ZHrjfpgpKh6wm4U1Pl3w3dwQyI4IzCI/HsWzgbymgHCz7or+zr9QprX2/FHN3LL HCbS70eu3ZPpg6tK6xNNXjXynDE1iQ8qdKey4bZBbczXeUP6wSz51Wdjebnkq6nl9Fnd XknZnIVdZ3UGMmQltfa0mJjpru3X9j6NPoJ1cXyRApciykxTknrH7od6d67uHR8hd07c OYxc19KBdONd8P15gS0w7AIn/12Ji5Rc5w2+IkGpTw+BX+y3bKGOEmCx677UMrunz9jV hqMpqaEZa/mJKWJba8ckIrGcX5m8oyKiVF8DcGhqfer15njSxfXs5rUm3X1eUwPeaHCv r8iA== 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 u4si4297701pfb.378.2018.02.10.21.14.45; Sat, 10 Feb 2018 21:14:58 -0800 (PST) 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 S1754016AbeBKFMd (ORCPT + 99 others); Sun, 11 Feb 2018 00:12:33 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:41404 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752623AbeBKEdl (ORCPT ); Sat, 10 Feb 2018 23:33:41 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ekjKd-0002hD-RM; Sun, 11 Feb 2018 04:33:39 +0000 Received: from ben by deadeye with local (Exim 4.90) (envelope-from ) id 1ekjKY-0004VX-CF; Sun, 11 Feb 2018 04:33:34 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "NeilBrown" , "Ian Kent" , "Linus Torvalds" Date: Sun, 11 Feb 2018 04:20:06 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.2 51/79] autofs: don't fail mount for transient error In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.2.99-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: NeilBrown commit ecc0c469f27765ed1e2b967be0aa17cee1a60b76 upstream. Currently if the autofs kernel module gets an error when writing to the pipe which links to the daemon, then it marks the whole moutpoint as catatonic, and it will stop working. It is possible that the error is transient. This can happen if the daemon is slow and more than 16 requests queue up. If a subsequent process tries to queue a request, and is then signalled, the write to the pipe will return -ERESTARTSYS and autofs will take that as total failure. So change the code to assess -ERESTARTSYS and -ENOMEM as transient failures which only abort the current request, not the whole mountpoint. It isn't a crash or a data corruption, but having autofs mountpoints suddenly stop working is rather inconvenient. Ian said: : And given the problems with a half dozen (or so) user space applications : consuming large amounts of CPU under heavy mount and umount activity this : could happen more easily than we expect. Link: http://lkml.kernel.org/r/87y3norvgp.fsf@notabene.neil.brown.name Signed-off-by: NeilBrown Acked-by: Ian Kent Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds [bwh: Backported to 3.2: autofs4_write() doesn't take an autofs_sb_info pointer] Signed-off-by: Ben Hutchings --- fs/autofs4/waitq.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) --- a/fs/autofs4/waitq.c +++ b/fs/autofs4/waitq.c @@ -88,7 +88,8 @@ static int autofs4_write(struct file *fi spin_unlock_irqrestore(¤t->sighand->siglock, flags); } - return (bytes > 0); + /* if 'wr' returned 0 (impossible) we assume -EIO (safe) */ + return bytes == 0 ? 0 : wr < 0 ? wr : -EIO; } static void autofs4_notify_daemon(struct autofs_sb_info *sbi, @@ -102,6 +103,7 @@ static void autofs4_notify_daemon(struct } pkt; struct file *pipe = NULL; size_t pktsz; + int ret; DPRINTK("wait id = 0x%08lx, name = %.*s, type=%d", (unsigned long) wq->wait_queue_token, wq->name.len, wq->name.name, type); @@ -180,7 +182,18 @@ static void autofs4_notify_daemon(struct mutex_unlock(&sbi->wq_mutex); if (autofs4_write(pipe, &pkt, pktsz)) + switch (ret = autofs4_write(pipe, &pkt, pktsz)) { + case 0: + break; + case -ENOMEM: + case -ERESTARTSYS: + /* Just fail this one */ + autofs4_wait_release(sbi, wq->wait_queue_token, ret); + break; + default: autofs4_catatonic_mode(sbi); + break; + } fput(pipe); }