2.0.0rc7 can not remove symbol-links

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



mode is present in loc->inode->st_mode and does not need a syscall.

Avati

On Thu, Mar 26, 2009 at 4:56 PM, Kirby Zhou <kirbyzhou at sohu-rd.com> wrote:
> 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: vikasgp at gmail.com [mailto:vikasgp at gmail.com] On Behalf Of Vikas Gorur
> Sent: Thursday, March 26, 2009 7:07 PM
> To: Kirby Zhou
> Cc: Anand Avati; gluster-users at gluster.org
> Subject: Re: 2.0.0rc7 can not remove symbol-links
>
> 2009/3/26 Kirby Zhou <kirbyzhou at sohu-rd.com>:
>> 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/
>
>
>



[Index of Archives]     [Gluster Development]     [Linux Filesytems Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux