Return-Path: Received: from fieldses.org ([173.255.197.46]:60068 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753299AbcKZBjl (ORCPT ); Fri, 25 Nov 2016 20:39:41 -0500 Date: Fri, 25 Nov 2016 20:39:39 -0500 From: "J. Bruce Fields" To: Eryu Guan Cc: Andreas Dilger , linux-fsdevel , fstests@vger.kernel.org, Linux NFS Mailing List Subject: [PATCH 2/2] dirstress: Allow ESTALE as well as ENOENT Message-ID: <20161126013939.GB32632@fieldses.org> References: <20161123222054.GA7900@fieldses.org> <35420A4E-1698-4743-9523-CBF43F2A2DC6@dilger.ca> <20161125034706.GA20729@fieldses.org> <20161125113511.GI4609@eguan.usersys.redhat.com> <20161126013901.GA32632@fieldses.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <20161126013901.GA32632@fieldses.org> Sender: linux-nfs-owner@vger.kernel.org List-ID: From: "J. Bruce Fields" In the NFS case an attempt to chdir out of a removed directory could result in ESTALE, and that should not cause the test to fail. This was causing intermittent failures on generic/011 on NFS. Signed-off-by: J. Bruce Fields --- src/dirstress.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/dirstress.c b/src/dirstress.c index f8f73553a1bc..33a166c51819 100644 --- a/src/dirstress.c +++ b/src/dirstress.c @@ -203,8 +203,10 @@ dirstress( if (verbose) fprintf(stderr,"** [%d] chdir ..\n", pid); error = chdir(".."); if (error) { - /* If this is multithreaded, then expecting a ENOENT here is fine */ - if (nprocs_per_dir > 1 && errno == ENOENT) { + /* If this is multithreaded, then expecting a ENOENT here is fine, + * and ESTALE is normal in the NFS case. */ + if (nprocs_per_dir > 1 && + (errno == ENOENT || errno = ESTALE)) { return 0; } @@ -224,8 +226,10 @@ dirstress( if (verbose) fprintf(stderr,"** [%d] chdir ..\n", pid); error = chdir(".."); if (error) { - /* If this is multithreaded, then expecting a ENOENT here is fine */ - if (nprocs_per_dir > 1 && errno == ENOENT) { + /* If this is multithreaded, then expecting a ENOENT here is fine, + * and ESTALE is normal in the NFS case. */ + if (nprocs_per_dir > 1 && + (errno == ENOENT || errno = ESTALE)) { return 0; } -- 2.9.3