xfs
[Top] [All Lists]

Permit xfs_repair -n on readonly device

To: linux-xfs@xxxxxxxxxxx
Subject: Permit xfs_repair -n on readonly device
From: Chris Pascoe <c.pascoe@xxxxxxxxxxxxxx>
Date: Sat, 2 Feb 2002 16:58:18 +1000
Sender: owner-linux-xfs@xxxxxxxxxxx
User-agent: Internet Messaging Program (IMP) 3.0
Hi,

May I suggest this patch to xfs_repair - to make a "xfs_repair -n" 
actually open the device read-only.  This permits running an 
xfs_repair -n over a readonly snapshot to check if the snapshot is 
okay.  It should be safe to do, as a nomodify repair shouldn't be 
modifying the filesystem anyway.

[root@toy xfs-cmd-20020122]# cvs diff -u cmd/xfsprogs/repair/io.c
Index: xfsprogs/repair/io.c
===================================================================
RCS file: /cvs/linux-2.4-xfs/cmd/xfsprogs/repair/io.c,v
retrieving revision 1.2
diff -u -r1.2 io.c
--- cmd/xfsprogs/repair/io.c        2001/05/09 06:56:06     1.2
+++ cmd/xfsprogs/repair/io.c        2002/02/02 07:46:45
@@ -45,7 +45,7 @@

        ASSERT(fs_name != NULL && *fs_name != '\0');

-       if ((fs_fd = open (fs_name, O_RDWR)) < 0)  {
+       if ((fs_fd = open (fs_name, (no_modify ? O_RDONLY : O_RDWR))) 
< 0)  {
                do_error("couldn't open filesystem \"%s\"\n",
                         fs_name);
        }

Regards,
Chris


<Prev in Thread] Current Thread [Next in Thread>