From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965874AbbDVJz0 (ORCPT ); Wed, 22 Apr 2015 05:55:26 -0400 Received: from s3.sipsolutions.net ([5.9.151.49]:53282 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964868AbbDVJzZ (ORCPT ); Wed, 22 Apr 2015 05:55:25 -0400 From: Johannes Berg To: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org Cc: j@w1.fi, Johannes Berg Subject: [PATCH] fs/9p: fix readdir() Date: Wed, 22 Apr 2015 11:55:14 +0200 Message-Id: <1429696514-14779-1-git-send-email-johannes@sipsolutions.net> X-Mailer: git-send-email 2.1.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johannes Berg Al Viro's IOV changes broke 9p readdir() because the new code didn't abort the read when it returned nothing. The original code checked if the combined error/length was <= 0 but in the new code that accidentally got changed to just an error check. Add back the return from the function when nothing is read. Cc: Al Viro Fixes: e1200fe68f20 ("9p: switch p9_client_read() to passing struct iov_iter *") Signed-off-by: Johannes Berg --- fs/9p/vfs_dir.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c index 76c3b1ab6361..5cc00e56206e 100644 --- a/fs/9p/vfs_dir.c +++ b/fs/9p/vfs_dir.c @@ -138,6 +138,8 @@ static int v9fs_dir_readdir(struct file *file, struct dir_context *ctx) &err); if (err) return err; + if (n == 0) + return 0; rdir->head = 0; rdir->tail = n; -- 2.1.4