All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] autofs: don't stuck in a loop if vfs_write returns an error
@ 2016-04-01  5:12 ` Andrey Vagin
  0 siblings, 0 replies; 20+ messages in thread
From: Andrey Vagin @ 2016-04-01  5:12 UTC (permalink / raw)
  To: Ian Kent; +Cc: autofs, linux-kernel, Andrey Vagin

From: Andrey Vagin <avagin@openvz.org>

__vfs_write() returns a negative value in a error case.

Cc: Ian Kent <raven@themaw.net>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
---
 fs/autofs4/waitq.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c
index 0146d91..631f155 100644
--- a/fs/autofs4/waitq.c
+++ b/fs/autofs4/waitq.c
@@ -66,11 +66,12 @@ static int autofs4_write(struct autofs_sb_info *sbi,
 	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);
 
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe autofs" in

^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [PATCH] autofs: don't stuck in a loop if vfs_write returns an error
@ 2016-06-16  8:31 ` Ian Kent
  0 siblings, 0 replies; 20+ messages in thread
From: Ian Kent @ 2016-06-16  8:31 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-fsdevel, autofs mailing list, Andrey Vagin,
	Kernel Mailing List

From: Andrey Vagin <avagin@openvz.org>

__vfs_write() returns a negative value in a error case.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Ian Kent <raven@themaw.net>
---
 fs/autofs4/waitq.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c
index 0146d91..631f155 100644
--- a/fs/autofs4/waitq.c
+++ b/fs/autofs4/waitq.c
@@ -66,11 +66,12 @@ static int autofs4_write(struct autofs_sb_info *sbi,
 	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);
 

--
To unsubscribe from this list: send the line "unsubscribe autofs" in

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2016-06-16  8:31 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-01  5:12 [PATCH] autofs: don't stuck in a loop if vfs_write returns an error Andrey Vagin
2016-04-01  5:12 ` Andrey Vagin
2016-04-01  7:37 ` Ian Kent
2016-04-01  7:37   ` Ian Kent
2016-05-23 21:50   ` Andrei Vagin
2016-05-23 21:50     ` Andrei Vagin
2016-05-24  1:34     ` Ian Kent
2016-05-24  1:34       ` Ian Kent
2016-05-30  5:52       ` Ian Kent
2016-05-30  5:52         ` Ian Kent
2016-06-09  1:23         ` Ian Kent
2016-06-09  1:23           ` Ian Kent
2016-06-09 17:27           ` Andrei Vagin
2016-06-10  8:45             ` Ian Kent
2016-06-10 19:07           ` Andrew Morton
2016-06-10 19:07             ` Andrew Morton
2016-06-16  7:58             ` Ian Kent
2016-06-16  7:58               ` Ian Kent
  -- strict thread matches above, loose matches on Subject: below --
2016-06-16  8:31 Ian Kent
2016-06-16  8:31 ` Ian Kent

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.