Re: [PATCH] Btrfs-progs: check out if the swap device

2013-02-13 Thread Zach Brown
> I think realpath() is unnecessary if it checks it by using only > stat() information. (if do not compare path) > > Am I misunderstanding anything? Sure, that'd be fine, but then you'd want to try unescaping the paths before stati()ng them. - z -- To unsubscribe from this list: send the line "u

Re: [PATCH] Btrfs-progs: check out if the swap device

2013-02-13 Thread Tsutomu Itoh
On 2013/02/14 6:58, Zach Brown wrote: why it failed. But it might not be able to because /proc/swaps is fundamentally unreliable. Then, how should we do?I have no idea... Hmm. I think I'd do something like: - First always open with O_EXCL. If it succeeds then there's no reason to c

Re: [PATCH] Btrfs-progs: check out if the swap device

2013-02-13 Thread Zach Brown
> >why it failed. But it might not be able to because /proc/swaps is > >fundamentally unreliable. > > Then, how should we do?I have no idea... Hmm. I think I'd do something like: - First always open with O_EXCL. If it succeeds then there's no reason to check /proc/swaps at all. (Maybe

Re: [PATCH] Btrfs-progs: check out if the swap device

2013-02-12 Thread Tsutomu Itoh
Hi, All, Thanks for advice. On 2013/02/13 5:57, Zach Brown wrote: So, I chose this one. (read /proc/swaps) Sure, I think your change is good. I just think perhaps mkfs should also try to open O_EXCL after all those other tests, as a last safety check. I think mkfs should first try an O_EX

Re: [PATCH] Btrfs-progs: check out if the swap device

2013-02-12 Thread Zach Brown
> > > > So, I chose this one. (read /proc/swaps) > > Sure, I think your change is good. I just think perhaps mkfs should also try > to open O_EXCL after all those other tests, as a last safety check. I think mkfs should first try an O_EXCL open. If that works it doesn't need to do any of this

Re: [PATCH] Btrfs-progs: check out if the swap device

2013-02-12 Thread Goffredo Baroncelli
On 02/12/2013 02:25 AM, Tsutomu Itoh wrote: > Currently, the following commands succeed. > > # cat /proc/swaps > FilenameTypeSizeUsed > Priority > /dev/sda3 partition 8388604 0 -1 > /dev/sdc8

Re: [PATCH] Btrfs-progs: check out if the swap device

2013-02-12 Thread Eric Sandeen
On 2/11/13 11:50 PM, Tsutomu Itoh wrote: > Hi, Eric, > > Thanks for your comment. > > On 2013/02/12 13:22, Eric Sandeen wrote: >> On 2/11/13 7:25 PM, Tsutomu Itoh wrote: >>> Currently, the following commands succeed. >>> >>> # cat /proc/swaps >>> FilenameType

Re: [PATCH] Btrfs-progs: check out if the swap device

2013-02-12 Thread David Sterba
On Tue, Feb 12, 2013 at 10:25:23AM +0900, Tsutomu Itoh wrote: > Currently, the following commands succeed. > > # cat /proc/swaps > FilenameTypeSizeUsed > Priority > /dev/sda3 partition 8388604 0 -1 >

Re: [PATCH] Btrfs-progs: check out if the swap device

2013-02-11 Thread Tsutomu Itoh
Hi, Eric, Thanks for your comment. On 2013/02/12 13:22, Eric Sandeen wrote: On 2/11/13 7:25 PM, Tsutomu Itoh wrote: Currently, the following commands succeed. # cat /proc/swaps FilenameTypeSizeUsed Priority /dev/sda3

Re: [PATCH] Btrfs-progs: check out if the swap device

2013-02-11 Thread Eric Sandeen
On 2/11/13 7:25 PM, Tsutomu Itoh wrote: > Currently, the following commands succeed. > > # cat /proc/swaps > FilenameTypeSizeUsed > Priority > /dev/sda3 partition 8388604 0 -1 > /dev/sdc8

[PATCH] Btrfs-progs: check out if the swap device

2013-02-11 Thread Tsutomu Itoh
Currently, the following commands succeed. # cat /proc/swaps FilenameTypeSizeUsed Priority /dev/sda3 partition 8388604 0 -1 /dev/sdc8 partition 9765884 0 -2