From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752745AbcEWVuW (ORCPT ); Mon, 23 May 2016 17:50:22 -0400 Received: from mail-lb0-f195.google.com ([209.85.217.195]:36685 "EHLO mail-lb0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752614AbcEWVuT (ORCPT ); Mon, 23 May 2016 17:50:19 -0400 MIME-Version: 1.0 In-Reply-To: <1459496266.2974.1.camel@themaw.net> References: <1459487558-21258-1-git-send-email-avagin@gmail.com> <1459496266.2974.1.camel@themaw.net> Date: Mon, 23 May 2016 14:50:17 -0700 Message-ID: Subject: Re: [PATCH] autofs: don't stuck in a loop if vfs_write returns an error From: Andrei Vagin To: Ian Kent Cc: autofs@vger.kernel.org, LKML Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Ian, When are you going to apply this patch? We can't test linux-next without it. Thanks, Andrew On Fri, Apr 1, 2016 at 12:37 AM, Ian Kent wrote: > On Thu, 2016-03-31 at 22:12 -0700, Andrey Vagin wrote: >> From: Andrey Vagin >> >> __vfs_write() returns a negative value in a error case. > > Ha, right, I'll send this along to Andrew with my next series which > should be soon. > >> >> Cc: Ian Kent >> Signed-off-by: Andrey Vagin >> --- >> 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); >>