From a59582c3faed3efcf713caeb990ea5c35479dd8d Mon Sep 17 00:00:00 2001 From: "Anand V. Avati" Date: Thu, 26 Mar 2009 16:26:21 +0530 Subject: posix_unlink - open/unlink/close only regular files Signed-off-by: Anand V. Avati --- xlators/storage/posix/src/posix.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'xlators/storage/posix/src/posix.c') diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index c20c7fec4..a2635e6ee 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -864,13 +864,16 @@ posix_unlink (call_frame_t *frame, xlator_t *this, SET_FS_ID (frame->root->uid, frame->root->gid); MAKE_REAL_PATH (real_path, this, loc->path); - fd = open (real_path, O_RDONLY); - if (fd == -1) { - op_ret = -1; - op_errno = errno; - gf_log (this->name, GF_LOG_WARNING, - "open of %s failed: %s", loc->path, strerror (op_errno)); - goto out; + if (S_ISREG (loc->inode->st_mode)) { + fd = open (real_path, O_RDONLY); + if (fd == -1) { + op_ret = -1; + op_errno = errno; + gf_log (this->name, GF_LOG_WARNING, + "open of %s failed: %s", loc->path, + strerror (op_errno)); + goto out; + } } op_ret = unlink (real_path); -- cgit