To test whether a file is regular is too expensive. First you stat file, secondly you open it, it consumes 2 syscall. It will only consumes one system call at all if you just open it and ignore the failure.
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Vikas Gorur Sent: Thursday, March 26, 2009 7:07 PM To: Kirby Zhou Cc: Anand Avati; [email protected] Subject: Re: [Gluster-users] 2.0.0rc7 can not remove symbol-links 2009/3/26 Kirby Zhou <[email protected]>: > My patch: > > ############## > --- glusterfs-2.0.0rc7.ori/xlators/storage/posix/src/posix.c 2009-03-26 > 18:50:11.000000000 +0800 > +++ glusterfs-2.0.0rc7/xlators/storage/posix/src/posix.c 2009-03-26 > 18:50:19.000000000 +0800 > @@ -866,11 +866,8 @@ > > 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); It'd be better to simply not do the open() on any file other than regular files. The fix is on its way to being committed. Thanks for spotting this, and sending the patch :) Vikas -- Engineer - Z Research http://gluster.com/ _______________________________________________ Gluster-users mailing list [email protected] http://zresearch.com/cgi-bin/mailman/listinfo/gluster-users
