From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de ([195.135.220.15]:44379 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934678AbdKCBkP (ORCPT ); Thu, 2 Nov 2017 21:40:15 -0400 From: NeilBrown To: Ian Kent , Andrew Morton Date: Fri, 03 Nov 2017 12:40:06 +1100 Subject: [PATCH] autofs: don't fail mount for transient error cc: lkml , linux-fsdevel@vger.kernel.org Message-ID: <87y3norvgp.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-fsdevel-owner@vger.kernel.org List-ID: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable 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. Signed-off-by: NeilBrown =2D-- Do people think this should got to -stable ?? It isn't a crash or a data corruption, but having autofs mountpoints suddenly stop working is rather inconvenient. Thanks, NeilBrown fs/autofs4/waitq.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c index 4ac49d038bf3..8fc41705c7cd 100644 =2D-- a/fs/autofs4/waitq.c +++ b/fs/autofs4/waitq.c @@ -81,7 +81,8 @@ static int autofs4_write(struct autofs_sb_info *sbi, spin_unlock_irqrestore(¤t->sighand->siglock, flags); } =20 =2D return (bytes > 0); + /* if 'wr' returned 0 (impossible) we assume -EIO (safe) */ + return bytes =3D=3D 0 ? 0 : wr < 0 ? wr : -EIO; } =20 static void autofs4_notify_daemon(struct autofs_sb_info *sbi, @@ -95,6 +96,7 @@ static void autofs4_notify_daemon(struct autofs_sb_info *= sbi, } pkt; struct file *pipe =3D NULL; size_t pktsz; + int ret; =20 pr_debug("wait id =3D 0x%08lx, name =3D %.*s, type=3D%d\n", (unsigned long) wq->wait_queue_token, @@ -169,7 +171,18 @@ static void autofs4_notify_daemon(struct autofs_sb_inf= o *sbi, mutex_unlock(&sbi->wq_mutex); =20 if (autofs4_write(sbi, pipe, &pkt, pktsz)) + switch (ret =3D autofs4_write(sbi, 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); } =20 =2D-=20 2.14.0.rc0.dirty --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEG8Yp69OQ2HB7X0l6Oeye3VZigbkFAln7yPcACgkQOeye3VZi gblvkQ//TBxYsfF2jwSVqapaPnpe5U9kqfGb6IpEcBlvGiUB8Ri1NLYgRdbVoReR rbuUkShV/kQ78etIOsKBI0mw5ttS39Ih8OOQhhfRaq0Tgydufyv8E54ZzKrPqS9s Fkq3HNPH9+OsjX8+iMQJeJCli9P+RrENYhvtYf5KPP9/rwoFKYPYqZFhIdAa0Uqc UMIsq7Pc3Kp+QSxVtZllbU5sbw6tOVJmV/I9BIA06q4iUTkB/R/rCl8YzaScrpGP HQTq5qIscH3Ed8JTvUJu/Ua5Te6Qs+Ep7X+/U4qJgd5JiHJhrYihAIkuMuoYdAv2 8/Ye+RjEAIN9QmNi6tfItfbp8JxrJjKJsbYHkU/NOudrgchAive5rQ2RQdnmmB6u Gvca50+NH8bVIV0r57oU9uboHS1FnbdNic0nNwu/9YnEzZIHYCIbb4NHzWweuBrF KbzZKfCdJszMUpfNaZbpOgewj+PZsxFz9HMtxytmUeRAw7UNeVDPbRoyTl/7FQdv QxPGGI1fbnsODb9vCA5ZrCJxyeA22d+dPv9NzogTWhFsSlBiLknreRWtKJB6hq1q WUW7BdvC66Ph+HZMGKCz/yUoJqBkvH0dF3mVNK4/DSIQU0ogHwEm0WIFbdT09bqb 3p1WIh0Acb9Q/OC612gJPz5iRhqHywPyuSL/l4JCIkWnu1VP3iE= =aVT0 -----END PGP SIGNATURE----- --=-=-=--