The patch titled Subject: autofs: don't get stuck in a loop if vfs_write() returns an error has been added to the -mm tree. Its filename is autofs-dont-stuck-in-a-loop-if-vfs_write-returns-an-error.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/autofs-dont-stuck-in-a-loop-if-vfs_write-returns-an-error.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/autofs-dont-stuck-in-a-loop-if-vfs_write-returns-an-error.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Andrey Vagin <avagin@xxxxxxxxxx> Subject: autofs: don't get stuck in a loop if vfs_write() returns an error __vfs_write() returns a negative value in a error case. Link: http://lkml.kernel.org/r/20160616083108.6278.65815.stgit@xxxxxxxxxxxxxxxx Signed-off-by: Andrey Vagin <avagin@xxxxxxxxxx> Signed-off-by: Ian Kent <raven@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/autofs4/waitq.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff -puN fs/autofs4/waitq.c~autofs-dont-stuck-in-a-loop-if-vfs_write-returns-an-error fs/autofs4/waitq.c --- a/fs/autofs4/waitq.c~autofs-dont-stuck-in-a-loop-if-vfs_write-returns-an-error +++ a/fs/autofs4/waitq.c @@ -66,11 +66,12 @@ static int autofs4_write(struct autofs_s set_fs(KERNEL_DS); mutex_lock(&sbi->pipe_mutex); - wr = __vfs_write(file, data, bytes, &file->f_pos); - while (bytes && wr) { + while (bytes) { + wr = __vfs_write(file, data, bytes, &file->f_pos); + if (wr <= 0) + break; data += wr; bytes -= wr; - wr = __vfs_write(file, data, bytes, &file->f_pos); } mutex_unlock(&sbi->pipe_mutex); _ Patches currently in -mm which might be from avagin@xxxxxxxxxx are autofs-dont-stuck-in-a-loop-if-vfs_write-returns-an-error.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html