diff options
author | Andrey Vagin <avagin@openvz.org> | 2016-06-24 17:50:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-06-24 20:23:52 -0400 |
commit | 5a9294e5c535deab69831076af15cd35e1c95f8b (patch) | |
tree | a13064c643cfc7e5ea8af20fdb20d971f67329f4 /fs | |
parent | 8285027fc479949a7a166bc1b26ce57e894878a7 (diff) |
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@pluto.themaw.net
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Ian Kent <raven@themaw.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/autofs4/waitq.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c index 0146d911f468..631f1554c87b 100644 --- a/fs/autofs4/waitq.c +++ b/fs/autofs4/waitq.c | |||
@@ -66,11 +66,12 @@ static int autofs4_write(struct autofs_sb_info *sbi, | |||
66 | set_fs(KERNEL_DS); | 66 | set_fs(KERNEL_DS); |
67 | 67 | ||
68 | mutex_lock(&sbi->pipe_mutex); | 68 | mutex_lock(&sbi->pipe_mutex); |
69 | wr = __vfs_write(file, data, bytes, &file->f_pos); | 69 | while (bytes) { |
70 | while (bytes && wr) { | 70 | wr = __vfs_write(file, data, bytes, &file->f_pos); |
71 | if (wr <= 0) | ||
72 | break; | ||
71 | data += wr; | 73 | data += wr; |
72 | bytes -= wr; | 74 | bytes -= wr; |
73 | wr = __vfs_write(file, data, bytes, &file->f_pos); | ||
74 | } | 75 | } |
75 | mutex_unlock(&sbi->pipe_mutex); | 76 | mutex_unlock(&sbi->pipe_mutex); |
76 | 77 | ||