All of lore.kernel.org
 help / color / mirror / Atom feed
* mkfs.btrfs broken
@ 2013-03-07 12:11 Swâmi Petaramesh
  2013-03-07 13:37 ` Eric Sandeen
  2013-03-07 14:13 ` Anand Jain
  0 siblings, 2 replies; 11+ messages in thread
From: Swâmi Petaramesh @ 2013-03-07 12:11 UTC (permalink / raw)
  To: BTRFS, Linux

Hi,

mkfs.btrfs v0.20-rc1, as provided in the excellent "Parted Magic" tool,
latest version dated 2013/02/28, is broken :

When trying to mkfs.btrfs - even on newly made, FS-free partition, it
always spits an error that it cannot check partition mount status and fails.

There has always been such an issue with mkfs.btrfs AFAIR, but it can
more or less work depending on the distribution etc...

In the past, some versions of mkfs.btrfs had a "-f" option that would
force formatting even if this test failed, but alas this option seems to
have disappeared...

PartedMagic being a "live CD", it might be easy to reproduce and check
what, exactly, goes wrong ?

Kind regards.

-- 
Swâmi Petaramesh <swami@petaramesh.org> http://petaramesh.org PGP 9076E32E
Ne cherchez pas : Je ne suis pas sur Facebook.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: mkfs.btrfs broken
  2013-03-07 12:11 mkfs.btrfs broken Swâmi Petaramesh
@ 2013-03-07 13:37 ` Eric Sandeen
  2013-03-07 15:09   ` Swâmi Petaramesh
  2013-03-07 14:13 ` Anand Jain
  1 sibling, 1 reply; 11+ messages in thread
From: Eric Sandeen @ 2013-03-07 13:37 UTC (permalink / raw)
  To: Swâmi Petaramesh; +Cc: BTRFS, Linux

On 3/7/13 6:11 AM, Swâmi Petaramesh wrote:
> Hi,
> 
> mkfs.btrfs v0.20-rc1, as provided in the excellent "Parted Magic" tool,
> latest version dated 2013/02/28, is broken :

Unfortunately "v0.20-rc1" spans months of development, since btrfs-progs
has no consistent release or versioning activity.

> When trying to mkfs.btrfs - even on newly made, FS-free partition, it
> always spits an error that it cannot check partition mount status and fails.

What error messages does it emit, anything helpful?

> There has always been such an issue with mkfs.btrfs AFAIR, but it can
> more or less work depending on the distribution etc...
> 
> In the past, some versions of mkfs.btrfs had a "-f" option that would
> force formatting even if this test failed, but alas this option seems to
> have disappeared...

The option is quite new, and still exists upstream.  But it only forces
overwrite of an existing filesystem, it has never affected the mount status
check AFAIK.

> PartedMagic being a "live CD", it might be easy to reproduce and check
> what, exactly, goes wrong ?

There are also steps you could take to investigate some more yourself:

Did earlier versions of the livecd work for you?
If so, when did it break?
Looking at the PartedMagic changelog, what were relevant changes?
Can you reproduce this outside the PartedMagic CD?
Is it possibly a PartedMagic bug?
Can you capture an strace of the failing mkfs.btrfs?

-Eric

> Kind regards.
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: mkfs.btrfs broken
  2013-03-07 12:11 mkfs.btrfs broken Swâmi Petaramesh
  2013-03-07 13:37 ` Eric Sandeen
@ 2013-03-07 14:13 ` Anand Jain
  1 sibling, 0 replies; 11+ messages in thread
From: Anand Jain @ 2013-03-07 14:13 UTC (permalink / raw)
  To: Swâmi Petaramesh; +Cc: BTRFS, Linux




On 03/07/2013 08:11 PM, Swâmi Petaramesh wrote:
> Hi,
>
> mkfs.btrfs v0.20-rc1, as provided in the excellent "Parted Magic" tool,
> latest version dated 2013/02/28, is broken :
>
> When trying to mkfs.btrfs - even on newly made, FS-free partition, it
> always spits an error that it cannot check partition mount status and fails.

  Can you share the command and error-output. Unless I know the actual
  error any suggestion/comments will just be a guess-work.

> There has always been such an issue with mkfs.btrfs AFAIR, but it can
> more or less work depending on the distribution etc...

  Yes. Most of these were printed as error without an impact.
  to have confirmation its better if you could share the
  command and its error-output.

regds, Anand

> In the past, some versions of mkfs.btrfs had a "-f" option that would
> force formatting even if this test failed, but alas this option seems to
> have disappeared...
>
> PartedMagic being a "live CD", it might be easy to reproduce and check
> what, exactly, goes wrong ?
>
> Kind regards.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: mkfs.btrfs broken
  2013-03-07 13:37 ` Eric Sandeen
@ 2013-03-07 15:09   ` Swâmi Petaramesh
  2013-03-07 15:13     ` Eric Sandeen
  0 siblings, 1 reply; 11+ messages in thread
From: Swâmi Petaramesh @ 2013-03-07 15:09 UTC (permalink / raw)
  To: BTRFS, Linux; +Cc: Eric Sandeen, Anand.Jain

Le 07/03/2013 14:37, Eric Sandeen a écrit :
> What error messages does it emit, anything helpful? 

root@partedmagic:~# file -s /dev/sda5
/dev/sda5: data

root@partedmagic:~# mkfs.btrfs /dev/sda5

WARNING! - Btrfs v0.20-rc1 IS EXPERIMENTAL
WARNING! - see http://btrfs.wiki.kernel.org before using

error checking /dev/sda5 mount status

root@partedmagic:~# echo $?
1

> The option is quite new, and still exists upstream. But it only forces
> overwrite of an existing filesystem, it has never affected the mount
> status check AFAIK. 

I remember that, in the past, I was several time able to override this
very error by using a -f switch...


> There are also steps you could take to investigate some more yourself:
> Did earlier versions of the livecd work for you? If so, when did it break?

It was broke first time I tried to use it more than a year ago ; I don't
clearly remember if it has been fixed at some point in time... I'm
positively sure that I saw the exact same error on other live distros
(possibly Ubuntu but not sure...)

> Can you capture an strace of the failing mkfs.btrfs? -Eric 

I don't know how to do this, I'm no developper myself...

Kind regards.

-- 
Swâmi Petaramesh <swami@petaramesh.org> http://petaramesh.org PGP 9076E32E
Ne cherchez pas : Je ne suis pas sur Facebook.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: mkfs.btrfs broken
  2013-03-07 15:09   ` Swâmi Petaramesh
@ 2013-03-07 15:13     ` Eric Sandeen
  2013-03-07 15:21       ` Swâmi Petaramesh
  0 siblings, 1 reply; 11+ messages in thread
From: Eric Sandeen @ 2013-03-07 15:13 UTC (permalink / raw)
  To: Swâmi Petaramesh; +Cc: BTRFS, Linux, Anand.Jain

On 3/7/13 9:09 AM, Swâmi Petaramesh wrote:
> Le 07/03/2013 14:37, Eric Sandeen a écrit :
>> What error messages does it emit, anything helpful? 
> 
> root@partedmagic:~# file -s /dev/sda5
> /dev/sda5: data
> 
> root@partedmagic:~# mkfs.btrfs /dev/sda5
> 
> WARNING! - Btrfs v0.20-rc1 IS EXPERIMENTAL
> WARNING! - see http://btrfs.wiki.kernel.org before using
> 
> error checking /dev/sda5 mount status

Ok, so that's unhelpful isn't it.  :)

> root@partedmagic:~# echo $?
> 1
> 
>> The option is quite new, and still exists upstream. But it only forces
>> overwrite of an existing filesystem, it has never affected the mount
>> status check AFAIK. 
> 
> I remember that, in the past, I was several time able to override this
> very error by using a -f switch...
> 

maybe it was some non-upstream hack I'm not aware of.

>> There are also steps you could take to investigate some more yourself:
>> Did earlier versions of the livecd work for you? If so, when did it break?
> 
> It was broke first time I tried to use it more than a year ago ; I don't
> clearly remember if it has been fixed at some point in time... I'm
> positively sure that I saw the exact same error on other live distros
> (possibly Ubuntu but not sure...)
> 
>> Can you capture an strace of the failing mkfs.btrfs? -Eric 
> I don't know how to do this, I'm no developper myself...

# strace -o tracefile.txt mkfs.btrfs /dev/sda5

tracefile.txt will contain all syscalls made by the binary and their results,
which might give us a clue what's gone wrong.

-Eric

> Kind regards.
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: mkfs.btrfs broken
  2013-03-07 15:13     ` Eric Sandeen
@ 2013-03-07 15:21       ` Swâmi Petaramesh
  2013-03-07 15:35         ` Chris Mason
  2013-03-07 18:06         ` Jérôme Poulin
  0 siblings, 2 replies; 11+ messages in thread
From: Swâmi Petaramesh @ 2013-03-07 15:21 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: BTRFS, Linux, Anand.Jain

Le 07/03/2013 16:13, Eric Sandeen a écrit :
> # strace -o tracefile.txt mkfs.btrfs /dev/sda5 tracefile.txt will
> contain all syscalls made by the binary and their results, which might
> give us a clue what's gone wrong. -Eric

Here it goes !

execve("/sbin/mkfs.btrfs", ["mkfs.btrfs", "/dev/sda5"], [/* 28 vars */]) = 0
brk(0)                                  = 0x9ee6000
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0xb76f0000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or
directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=48297, ...}) = 0
mmap2(NULL, 48297, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb76e4000
close(3)                                = 0
open("/lib/libuuid.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3,
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0@\16\0\0004\0\0\0"...,
512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=11888, ...}) = 0
mmap2(NULL, 14712, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0)
= 0xb76e0000
mmap2(0xb76e3000, 4096, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2) = 0xb76e3000
close(3)                                = 0
open("/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3,
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0@D\0\0004\0\0\0"...,
512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=202934, ...}) = 0
mmap2(NULL, 176256, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3,
0) = 0xb76b4000
mmap2(0xb76de000, 8192, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x29) = 0xb76de000
close(3)                                = 0
open("/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3,
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\0\227\1\0004\0\0\0"...,
512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1769964, ...}) = 0
mmap2(NULL, 1571356, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3,
0) = 0xb7534000
mmap2(0xb76ae000, 12288, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x179) = 0xb76ae000
mmap2(0xb76b1000, 10780, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb76b1000
close(3)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0xb7533000
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0xb7532000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb7532700,
limit:1048575, seg_32bit:1, contents:0, read_exec_only:0,
limit_in_pages:1, seg_not_present:0, useable:1}) = 0
mprotect(0xb76ae000, 8192, PROT_READ)   = 0
mprotect(0xb76de000, 4096, PROT_READ)   = 0
mprotect(0xb7712000, 4096, PROT_READ)   = 0
munmap(0xb76e4000, 48297)               = 0
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0xb76ef000
write(1, "\n", 1)                       = 1
write(1, "WARNING! - Btrfs v0.20-rc1 IS EX"..., 43) = 43
write(1, "WARNING! - see http://btrfs.wiki"..., 57) = 57
write(1, "\n", 1)                       = 1
open("/dev/sda5", O_RDONLY|O_LARGEFILE) = 3
brk(0)                                  = 0x9ee6000
brk(0x9f08000)                          = 0x9f08000
pread64(3,
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"...,
3531, 65536) = 3531
pread64(3,
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"...,
3531, 67108864) = 3531
pread64(3, "", 3531, 274877906944)      = 0
brk(0x9f07000)                          = 0x9f07000
open("/proc/mounts", O_RDONLY|O_CLOEXEC) = 4
fstat64(4, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0xb76ee000
read(4, "rootfs / rootfs rw 0 0\nproc /pro"..., 1024) = 480
stat64("rootfs", 0xbff5b970)            = -1 ENOENT (No such file or
directory)
stat64("proc", 0xbff5b970)              = -1 ENOENT (No such file or
directory)
stat64("sysfs", 0xbff5b970)             = -1 ENOENT (No such file or
directory)
stat64("devtmpfs", 0xbff5b970)          = -1 ENOENT (No such file or
directory)
stat64("tmpfs", 0xbff5b970)             = -1 ENOENT (No such file or
directory)
stat64("devpts", 0xbff5b970)            = -1 ENOENT (No such file or
directory)
stat64("fusectl", 0xbff5b970)           = -1 ENOENT (No such file or
directory)
stat64("/dev/loop2", {st_mode=S_IFBLK|0660, st_rdev=makedev(7, 2), ...}) = 0
stat64("/dev/sda5", {st_mode=S_IFBLK|0660, st_rdev=makedev(8, 5), ...}) = 0
stat64("/dev/loop2", {st_mode=S_IFBLK|0660, st_rdev=makedev(7, 2), ...}) = 0
open("/dev/loop2", O_RDONLY|O_LARGEFILE) = 5
ioctl(5, 0x4c03, 0xbff59904)            = 0
close(5)                                = 0
lstat64("/dev", {st_mode=S_IFDIR|0755, st_size=10060, ...}) = 0
lstat64("/dev/sda5", {st_mode=S_IFBLK|0660, st_rdev=makedev(8, 5), ...}) = 0
lstat64("/sqfs_disk", 0xbff57820)       = -1 ENOENT (No such file or
directory)
close(4)                                = 0
munmap(0xb76ee000, 4096)                = 0
close(3)                                = 0
write(2, "error checking /dev/sda5 mount s"..., 38) = 38
exit_group(1)                           = ?

-- 
Swâmi Petaramesh <swami@petaramesh.org> http://petaramesh.org PGP 9076E32E
Ne cherchez pas : Je ne suis pas sur Facebook.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: mkfs.btrfs broken
  2013-03-07 15:21       ` Swâmi Petaramesh
@ 2013-03-07 15:35         ` Chris Mason
  2013-03-07 15:40           ` Swâmi Petaramesh
  2013-03-07 18:06         ` Jérôme Poulin
  1 sibling, 1 reply; 11+ messages in thread
From: Chris Mason @ 2013-03-07 15:35 UTC (permalink / raw)
  To: Swâmi Petaramesh; +Cc: Eric Sandeen, BTRFS, Linux, Anand.Jain

On Thu, Mar 07, 2013 at 08:21:51AM -0700, Swâmi Petaramesh wrote:
> Le 07/03/2013 16:13, Eric Sandeen a écrit :
> > # strace -o tracefile.txt mkfs.btrfs /dev/sda5 tracefile.txt will
> > contain all syscalls made by the binary and their results, which might
> > give us a clue what's gone wrong. -Eric
> 
> Here it goes !

Could you please send the contents of /proc/mounts

-chris

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: mkfs.btrfs broken
  2013-03-07 15:35         ` Chris Mason
@ 2013-03-07 15:40           ` Swâmi Petaramesh
  0 siblings, 0 replies; 11+ messages in thread
From: Swâmi Petaramesh @ 2013-03-07 15:40 UTC (permalink / raw)
  To: Chris Mason, Eric Sandeen, BTRFS, Linux, Anand.Jain

Le 07/03/2013 16:35, Chris Mason a écrit :
> Could you please send the contents of /proc/mounts
Here it goes !

(Last line is the USB key I dropped in just for taking a copy of
/proc/mounts ; it didn't exist at the time the errors occured...)

rootfs / rootfs rw 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
devtmpfs /dev devtmpfs
rw,relatime,size=990948k,nr_inodes=170721,mode=755 0 0
tmpfs /run tmpfs rw,relatime 0 0
devpts /dev/pts devpts rw,relatime,gid=5,mode=620,ptmxmode=000 0 0
fusectl /sys/fs/fuse/connections fusectl rw,relatime 0 0
/dev/loop2 /br_sqfs squashfs ro,relatime 0 0
aufs / aufs rw,relatime,si=6434ca9 0 0
tmpfs /tmp tmpfs rw,relatime 0 0
nfsd /proc/fs/nfsd nfsd rw,relatime 0 0
/dev/sdc1 /media/sdc1 vfat
rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro
0 0

-- 
Swâmi Petaramesh <swami@petaramesh.org> http://petaramesh.org PGP 9076E32E
Ne cherchez pas : Je ne suis pas sur Facebook.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: mkfs.btrfs broken
  2013-03-07 15:21       ` Swâmi Petaramesh
  2013-03-07 15:35         ` Chris Mason
@ 2013-03-07 18:06         ` Jérôme Poulin
  2013-03-07 18:10           ` Swâmi Petaramesh
  1 sibling, 1 reply; 11+ messages in thread
From: Jérôme Poulin @ 2013-03-07 18:06 UTC (permalink / raw)
  To: Swâmi Petaramesh; +Cc: Eric Sandeen, BTRFS, Linux, Anand Jain

On Thu, Mar 7, 2013 at 10:21 AM, Swâmi Petaramesh <swami@petaramesh.org> wrote:
> lstat64("/sqfs_disk", 0xbff57820)       = -1 ENOENT (No such file or
> directory)

mkfs.btrfs tries to lookup loop devices by their filenames and fails
if any loop device file is missing.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: mkfs.btrfs broken
  2013-03-07 18:06         ` Jérôme Poulin
@ 2013-03-07 18:10           ` Swâmi Petaramesh
  2013-03-07 21:38             ` Mitch Harder
  0 siblings, 1 reply; 11+ messages in thread
From: Swâmi Petaramesh @ 2013-03-07 18:10 UTC (permalink / raw)
  To: Jérôme Poulin; +Cc: Eric Sandeen, BTRFS, Linux, Anand Jain

Le 07/03/2013 19:06, Jérôme Poulin a écrit :
> mkfs.btrfs tries to lookup loop devices by their filenames and fails
> if any loop device file is missing.

Hmm.... Why would mkfs.btrfs want to lookup anything else but the device
we're trying to format, to check if it's mounted or not ?

-- 
Swâmi Petaramesh <swami@petaramesh.org> http://petaramesh.org PGP 9076E32E
Ne cherchez pas : Je ne suis pas sur Facebook.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: mkfs.btrfs broken
  2013-03-07 18:10           ` Swâmi Petaramesh
@ 2013-03-07 21:38             ` Mitch Harder
  0 siblings, 0 replies; 11+ messages in thread
From: Mitch Harder @ 2013-03-07 21:38 UTC (permalink / raw)
  To: Swâmi Petaramesh
  Cc: Jérôme Poulin, Eric Sandeen, BTRFS, Linux, Anand Jain

On Thu, Mar 7, 2013 at 12:10 PM, Swâmi Petaramesh <swami@petaramesh.org> wrote:
> Le 07/03/2013 19:06, Jérôme Poulin a écrit :
>> mkfs.btrfs tries to lookup loop devices by their filenames and fails
>> if any loop device file is missing.
>
> Hmm.... Why would mkfs.btrfs want to lookup anything else but the device
> we're trying to format, to check if it's mounted or not ?
>

At Sabayon, we pretty-much hacked our way around this with a
"make-it-go" kind of patch.

Otherwise, our installation would break with btrfs on our
Live-[CD/DVD/USB] media.

I know we should have taken the time to put together a proper
solution, but I could never figure out the  reasoning for needing to
scan every device either.

--- btrfs-progs-0.19.orig/utils.c
+++ btrfs-progs-0.19/utils.c
@@ -708,6 +708,21 @@ int is_same_blk_file(const char* a, cons
 	return 0;
 }

+/* Checks if a file exists and is a block or regular file*/
+int is_existing_blk_or_reg_file(const char* filename)
+{
+	struct stat st_buf;
+
+	if(stat(filename, &st_buf) < 0) {
+		if(errno == ENOENT)
+			return 0;
+		else
+			return -errno;
+	}
+
+	return (S_ISBLK(st_buf.st_mode) || S_ISREG(st_buf.st_mode));
+}
+
 /* checks if a and b are identical or device
  * files associated with the same block device or
  * if one file is a loop device that uses the other
@@ -727,7 +742,10 @@ int is_same_loop_file(const char* a, con
 	} else if(ret) {
 		if((ret = resolve_loop_device(a, res_a, sizeof(res_a))) < 0)
 			return ret;
-
+		/* if the resolved path is not available, there is nothing
+		   we can do */
+		if((ret = is_existing_blk_or_reg_file(res_a)) == 0)
+			return ret;
 		final_a = res_a;
 	} else {
 		final_a = a;
@@ -739,6 +757,10 @@ int is_same_loop_file(const char* a, con
 	} else if(ret) {
 		if((ret = resolve_loop_device(b, res_b, sizeof(res_b))) < 0)
 			return ret;
+		/* if the resolved path is not available, there is nothing
+		   we can do */
+		if((ret = is_existing_blk_or_reg_file(res_b)) == 0)
+			return ret;

 		final_b = res_b;
 	} else {
@@ -748,21 +770,6 @@ int is_same_loop_file(const char* a, con
 	return is_same_blk_file(final_a, final_b);
 }

-/* Checks if a file exists and is a block or regular file*/
-int is_existing_blk_or_reg_file(const char* filename)
-{
-	struct stat st_buf;
-
-	if(stat(filename, &st_buf) < 0) {
-		if(errno == ENOENT)
-			return 0;
-		else
-			return -errno;
-	}
-
-	return (S_ISBLK(st_buf.st_mode) || S_ISREG(st_buf.st_mode));
-}
-
 /* Checks if a file is used (directly or indirectly via a loop device)
  * by a device in fs_devices
  */

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-03-07 21:39 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-07 12:11 mkfs.btrfs broken Swâmi Petaramesh
2013-03-07 13:37 ` Eric Sandeen
2013-03-07 15:09   ` Swâmi Petaramesh
2013-03-07 15:13     ` Eric Sandeen
2013-03-07 15:21       ` Swâmi Petaramesh
2013-03-07 15:35         ` Chris Mason
2013-03-07 15:40           ` Swâmi Petaramesh
2013-03-07 18:06         ` Jérôme Poulin
2013-03-07 18:10           ` Swâmi Petaramesh
2013-03-07 21:38             ` Mitch Harder
2013-03-07 14:13 ` Anand Jain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.