From 077d73fa467bcd0a5ac4be26bb4b366d5fc20a69 Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Fri, 9 Oct 2009 09:15:36 +0000 Subject: posix: Ensure ENOTEMPTY return on rmdir Since we added an extra step after rmdir, i.e. the lstat on parent dir as part of the NFS-friendly changes, the successful return from postparent lstat clobbers the -1 error return from rmdir. This prevents this particularly ENOTEMPTY error from being propagated to higher translators. Signed-off-by: Anand V. Avati BUG: 145 (NFSv3 related additions to 2.1 task list) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=145 --- xlators/storage/posix/src/posix.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index f681b1dc69c..fa70dd274fb 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -1486,13 +1486,16 @@ posix_rmdir (call_frame_t *frame, xlator_t *this, /* Solaris sets errno = EEXIST instead of ENOTEMPTY */ op_errno = ENOTEMPTY; + /* No need to log a common error as ENOTEMPTY */ if (op_ret == -1 && op_errno != ENOTEMPTY) { gf_log (this->name, GF_LOG_ERROR, "rmdir of %s failed: %s", loc->path, strerror (op_errno)); - goto out; } + if (op_ret == -1) + goto out; + op_ret = lstat (parentpath, &postparent); if (op_ret == -1) { op_errno = errno; -- cgit