* Re: [BUG] remount ro on loopback mount leaves unmountable filesystem behind
@ 2008-05-13 10:23 ` Christoph Hellwig
0 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2008-05-13 10:23 UTC (permalink / raw)
To: David Chinner; +Cc: lkml, linux-fsdevel, util-linux-ng-u79uwXL29TY76Z2rM5mHXA
On Tue, May 13, 2008 at 06:50:47PM +1000, David Chinner wrote:
> Same thing, but remounting the loop filesystem readonly
> before unmounting:
>
> $ mount -t xfs /dev/sdb6 /mnt/scratch
> $ mkdir /mnt/scratch/mnt
> $ touch /mnt/scratch/img
> $ mkfs.xfs -f -d file,name=/mnt/scratch/img,size=1g
> $ mount -t xfs -o loop /mnt/scratch/img /mnt/scratch/mnt
> $ mount -t xfs -o remount,ro /mnt/scratch/img /mnt/scratch/mnt
> $ umount /mnt/scratch/mnt
> $ umount /mnt/scratch
> umount: /mnt/scratch: device is busy
> umount: /mnt/scratch: device is busy
This is a problem in mount, no the kernel. Before the remount the
/etc mtab looks something like this:
/qemu/test.img /mnt xfs rw,loop=/dev/loop0 0 0
and after it looks something like this:
/qemu/test.img /mnt xfs ro 0 0
As a workaround do a losetup -d /dev/loop0 after unmounting the
filesystem.
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [BUG] remount ro on loopback mount leaves unmountable filesystem behind
2008-05-13 10:23 ` Christoph Hellwig
(?)
@ 2008-05-13 12:07 ` David Chinner
2008-05-13 12:42 ` Christoph Hellwig
-1 siblings, 1 reply; 9+ messages in thread
From: David Chinner @ 2008-05-13 12:07 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: David Chinner, lkml, linux-fsdevel, util-linux-ng
On Tue, May 13, 2008 at 06:23:40AM -0400, Christoph Hellwig wrote:
> On Tue, May 13, 2008 at 06:50:47PM +1000, David Chinner wrote:
> > Same thing, but remounting the loop filesystem readonly
> > before unmounting:
> >
> > $ mount -t xfs /dev/sdb6 /mnt/scratch
> > $ mkdir /mnt/scratch/mnt
> > $ touch /mnt/scratch/img
> > $ mkfs.xfs -f -d file,name=/mnt/scratch/img,size=1g
> > $ mount -t xfs -o loop /mnt/scratch/img /mnt/scratch/mnt
> > $ mount -t xfs -o remount,ro /mnt/scratch/img /mnt/scratch/mnt
> > $ umount /mnt/scratch/mnt
> > $ umount /mnt/scratch
> > umount: /mnt/scratch: device is busy
> > umount: /mnt/scratch: device is busy
>
> This is a problem in mount, no the kernel. Before the remount the
> /etc mtab looks something like this:
>
> /qemu/test.img /mnt xfs rw,loop=/dev/loop0 0 0
>
> and after it looks something like this:
>
> /qemu/test.img /mnt xfs ro 0 0
>
> As a workaround do a losetup -d /dev/loop0 after unmounting the
> filesystem.
Hmmm - I even considered that and tried a '-o remount,ro,loop'
but that obviously doesn't work with dynamic loop device instantiation,
either.
/me didn't read all the way to the bottom of the extremely verbose
mount man page so didn't find the bit about losetup -d....
Anyway, I'll hard code loop device numbers into the script so
I can just forget about this problem. Thanks, Christoph.
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [BUG] remount ro on loopback mount leaves unmountable filesystem behind
@ 2008-05-13 12:42 ` Christoph Hellwig
0 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2008-05-13 12:42 UTC (permalink / raw)
To: David Chinner; +Cc: Christoph Hellwig, lkml, linux-fsdevel, util-linux-ng
On Tue, May 13, 2008 at 10:07:10PM +1000, David Chinner wrote:
> Anyway, I'll hard code loop device numbers into the script so
> I can just forget about this problem. Thanks, Christoph.
hardcoding them is a little dangerous because a system might aswell
have them in use already, e.g. for CD images. Just use losetup -f to
find the first free one and keep it in a shell variable.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [BUG] remount ro on loopback mount leaves unmountable filesystem behind
@ 2008-05-13 12:42 ` Christoph Hellwig
0 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2008-05-13 12:42 UTC (permalink / raw)
To: David Chinner
Cc: Christoph Hellwig, lkml, linux-fsdevel,
util-linux-ng-u79uwXL29TY76Z2rM5mHXA
On Tue, May 13, 2008 at 10:07:10PM +1000, David Chinner wrote:
> Anyway, I'll hard code loop device numbers into the script so
> I can just forget about this problem. Thanks, Christoph.
hardcoding them is a little dangerous because a system might aswell
have them in use already, e.g. for CD images. Just use losetup -f to
find the first free one and keep it in a shell variable.
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [BUG] remount ro on loopback mount leaves unmountable filesystem behind
@ 2008-05-13 17:10 ` H. Peter Anvin
0 siblings, 0 replies; 9+ messages in thread
From: H. Peter Anvin @ 2008-05-13 17:10 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: David Chinner, lkml, linux-fsdevel, util-linux-ng
Christoph Hellwig wrote:
> On Tue, May 13, 2008 at 10:07:10PM +1000, David Chinner wrote:
>> Anyway, I'll hard code loop device numbers into the script so
>> I can just forget about this problem. Thanks, Christoph.
>
> hardcoding them is a little dangerous because a system might aswell
> have them in use already, e.g. for CD images. Just use losetup -f to
> find the first free one and keep it in a shell variable.
losetup -f is racy, too. losetup -sf is safe, however.
-hpa
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [BUG] remount ro on loopback mount leaves unmountable filesystem behind
@ 2008-05-13 17:10 ` H. Peter Anvin
0 siblings, 0 replies; 9+ messages in thread
From: H. Peter Anvin @ 2008-05-13 17:10 UTC (permalink / raw)
To: Christoph Hellwig
Cc: David Chinner, lkml, linux-fsdevel,
util-linux-ng-u79uwXL29TY76Z2rM5mHXA
Christoph Hellwig wrote:
> On Tue, May 13, 2008 at 10:07:10PM +1000, David Chinner wrote:
>> Anyway, I'll hard code loop device numbers into the script so
>> I can just forget about this problem. Thanks, Christoph.
>
> hardcoding them is a little dangerous because a system might aswell
> have them in use already, e.g. for CD images. Just use losetup -f to
> find the first free one and keep it in a shell variable.
losetup -f is racy, too. losetup -sf is safe, however.
-hpa
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [BUG] remount ro on loopback mount leaves unmountable filesystem behind
2008-05-13 10:23 ` Christoph Hellwig
(?)
(?)
@ 2008-05-13 22:55 ` Karel Zak
-1 siblings, 0 replies; 9+ messages in thread
From: Karel Zak @ 2008-05-13 22:55 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: David Chinner, lkml, linux-fsdevel, util-linux-ng
On Tue, May 13, 2008 at 06:23:40AM -0400, Christoph Hellwig wrote:
> On Tue, May 13, 2008 at 06:50:47PM +1000, David Chinner wrote:
> > Same thing, but remounting the loop filesystem readonly
> > before unmounting:
> >
> > $ mount -t xfs /dev/sdb6 /mnt/scratch
> > $ mkdir /mnt/scratch/mnt
> > $ touch /mnt/scratch/img
> > $ mkfs.xfs -f -d file,name=/mnt/scratch/img,size=1g
> > $ mount -t xfs -o loop /mnt/scratch/img /mnt/scratch/mnt
> > $ mount -t xfs -o remount,ro /mnt/scratch/img /mnt/scratch/mnt
> > $ umount /mnt/scratch/mnt
> > $ umount /mnt/scratch
> > umount: /mnt/scratch: device is busy
> > umount: /mnt/scratch: device is busy
>
> This is a problem in mount, no the kernel. Before the remount the
> /etc mtab looks something like this:
>
> /qemu/test.img /mnt xfs rw,loop=/dev/loop0 0 0
>
> and after it looks something like this:
>
> /qemu/test.img /mnt xfs ro 0 0
Yes, that's mount(8) bug. It doesn't read old options from /etc/mtab
when you remount by "mount -o remount <src> <dest>".
> As a workaround do a losetup -d /dev/loop0 after unmounting the
> filesystem.
... or use "mount -o remount <dest>", for example:
mount -t xfs -o remount,ro /mnt/scratch/mnt
Karel
--
Karel Zak <kzak@redhat.com>
^ permalink raw reply [flat|nested] 9+ messages in thread