Commit ab96d9c2 authored by NeilBrown's avatar NeilBrown Committed by Greg Kroah-Hartman

autofs: don't fail mount for transient error

commit ecc0c469 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.nameSigned-off-by: default avatarNeilBrown <neilb@suse.com>
Acked-by: default avatarIan Kent <raven@themaw.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f2c97052
...@@ -87,7 +87,8 @@ static int autofs4_write(struct autofs_sb_info *sbi, ...@@ -87,7 +87,8 @@ static int autofs4_write(struct autofs_sb_info *sbi,
spin_unlock_irqrestore(&current->sighand->siglock, flags); spin_unlock_irqrestore(&current->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, static void autofs4_notify_daemon(struct autofs_sb_info *sbi,
...@@ -101,6 +102,7 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi, ...@@ -101,6 +102,7 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi,
} pkt; } pkt;
struct file *pipe = NULL; struct file *pipe = NULL;
size_t pktsz; size_t pktsz;
int ret;
pr_debug("wait id = 0x%08lx, name = %.*s, type=%d\n", pr_debug("wait id = 0x%08lx, name = %.*s, type=%d\n",
(unsigned long) wq->wait_queue_token, (unsigned long) wq->wait_queue_token,
...@@ -175,7 +177,18 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi, ...@@ -175,7 +177,18 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi,
mutex_unlock(&sbi->wq_mutex); mutex_unlock(&sbi->wq_mutex);
if (autofs4_write(sbi, pipe, &pkt, pktsz)) if (autofs4_write(sbi, pipe, &pkt, pktsz))
switch (ret = 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); autofs4_catatonic_mode(sbi);
break;
}
fput(pipe); fput(pipe);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment