public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mkfs: don't try to detect filesystems on regular files via blkid
@ 2010-02-04 16:34 Eric Sandeen
  2010-02-04 16:46 ` Jim Meyering
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Eric Sandeen @ 2010-02-04 16:34 UTC (permalink / raw)
  To: xfs mailing list; +Cc: Jim Meyering

from RH bug 
https://bugzilla.redhat.com/show_bug.cgi?id=561870

# dd if=/dev/zero of=k bs=1MB count=2 seek=20; mkfs.xfs k 
# mkfs.xfs: probe of k failed, cannot detect existing filesystem.
# mkfs.xfs: Use the -f option to force overwrite.

blkid fails to do a probe of a regular file.

I wish blkid would cope with this, but for now it might
be better to just turn it off.

Reported-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index 9baf116..de87647 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -300,10 +300,15 @@ check_overwrite(
 	int		fd;
 	long long	size;
 	int		bsz;
+	struct stat	statbuf;
 
 	if (!device || !*device)
 		return 0;
 
+	/* blkid can't get info from a regular file */
+	if (!stat(device, &statbuf) && S_ISREG(statbuf.st_mode))
+		return 0;
+
 	ret = -1; /* will reset on success of all setup calls */
 
 	fd = open(device, O_RDONLY);

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

end of thread, other threads:[~2010-02-05  3:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-04 16:34 [PATCH] mkfs: don't try to detect filesystems on regular files via blkid Eric Sandeen
2010-02-04 16:46 ` Jim Meyering
2010-02-04 16:54   ` Eric Sandeen
2010-02-04 17:48 ` [PATCH V2] " Eric Sandeen
2010-02-04 19:43   ` Eric Sandeen
2010-02-04 19:40 ` [PATCH] mkfs.xfs fix detection of empty devices Christoph Hellwig
2010-02-04 20:15   ` Eric Sandeen
2010-02-04 22:18   ` [PATCH v2] " Christoph Hellwig
2010-02-05  3:41     ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox