diff mbox

[Oneiric,SRU] Fix loop device notificaitons.

Message ID 4F16E971.8020800@canonical.com
State New
Headers show

Commit Message

Ayan George Jan. 18, 2012, 3:46 p.m. UTC
SRU Justification:

Impact: The loop device does not emit a change uevent when autoreleasing
a device.  Programs that depend on uevents (like gvfs and ultimately
Nautilus) never notice when loop devices are unmounted.

Bug-Link: https://bugs.launchpad.net/ubuntu/+source/usb-creator/+bug/548546

Fix: Apply 8a9c594422ecad912d6470888acdee9a1236ad68 from linux mainline
-- Pass a valid bdev pointer to loop_clr_fd() instead of NULL so that
it will emit the uevent.

The patch is very small and applies cleanly to ubuntu-oneiric.

Testcase:

(1) In a terminal, start udevadm in monitor mode:

  $ udevadm monitor

(2) In another terminal, mount an ISO image using the loopback device:

  $ sudo mount -o loop -t iso9660 your_image.iso /mnt

(3) Notice the change uevents that udevadm reports.

(4) Unmount image:

  $ sudo umount /mnt

(5) Note that udevadm does not report any changes.  With the patch
applied, you will see the kernel noticiations.

Comments

Tim Gardner Jan. 19, 2012, 12:47 p.m. UTC | #1
On 01/18/2012 08:46 AM, Ayan George wrote:
>
> SRU Justification:
>
> Impact: The loop device does not emit a change uevent when autoreleasing
> a device.  Programs that depend on uevents (like gvfs and ultimately
> Nautilus) never notice when loop devices are unmounted.
>
> Bug-Link: https://bugs.launchpad.net/ubuntu/+source/usb-creator/+bug/548546
>
> Fix: Apply 8a9c594422ecad912d6470888acdee9a1236ad68 from linux mainline
> -- Pass a valid bdev pointer to loop_clr_fd() instead of NULL so that
> it will emit the uevent.
>
> The patch is very small and applies cleanly to ubuntu-oneiric.
>
> Testcase:
>
> (1) In a terminal, start udevadm in monitor mode:
>
>    $ udevadm monitor
>
> (2) In another terminal, mount an ISO image using the loopback device:
>
>    $ sudo mount -o loop -t iso9660 your_image.iso /mnt
>
> (3) Notice the change uevents that udevadm reports.
>
> (4) Unmount image:
>
>    $ sudo umount /mnt
>
> (5) Note that udevadm does not report any changes.  With the patch
> applied, you will see the kernel noticiations.
>
>
>
>
>
Herton Ronaldo Krzesinski Jan. 19, 2012, 1:15 p.m. UTC | #2
On Wed, Jan 18, 2012 at 10:46:57AM -0500, Ayan George wrote:
> 
> SRU Justification:
> 
> Impact: The loop device does not emit a change uevent when autoreleasing
> a device.  Programs that depend on uevents (like gvfs and ultimately
> Nautilus) never notice when loop devices are unmounted.
> 
> Bug-Link: https://bugs.launchpad.net/ubuntu/+source/usb-creator/+bug/548546
> 
> Fix: Apply 8a9c594422ecad912d6470888acdee9a1236ad68 from linux mainline
> -- Pass a valid bdev pointer to loop_clr_fd() instead of NULL so that
> it will emit the uevent.
> 
> The patch is very small and applies cleanly to ubuntu-oneiric.
> 
> Testcase:
> 
> (1) In a terminal, start udevadm in monitor mode:
> 
>   $ udevadm monitor
> 
> (2) In another terminal, mount an ISO image using the loopback device:
> 
>   $ sudo mount -o loop -t iso9660 your_image.iso /mnt
> 
> (3) Notice the change uevents that udevadm reports.
> 
> (4) Unmount image:
> 
>   $ sudo umount /mnt
> 
> (5) Note that udevadm does not report any changes.  With the patch
> applied, you will see the kernel noticiations.
> 
> 

> From 8a9c594422ecad912d6470888acdee9a1236ad68 Mon Sep 17 00:00:00 2001
> From: Phillip Susi <psusi@cfl.rr.com>
> Date: Wed, 21 Sep 2011 10:02:13 +0200
> Subject: [PATCH] drivers/block/loop.c: emit uevent on auto release
> 
> The loopback driver failed to emit the change uevent when auto releasing
> the device.  Fixed lo_release() to pass the bdev to loop_clr_fd() so it
> can emit the event.
> 
> Signed-off-by: Phillip Susi <psusi@cfl.rr.com>
> Cc: Jens Axboe <axboe@kernel.dk>
> Cc: Ayan George <ayan@ayan.net>
> Signed-off-by: Andrew Morton <akpm@google.com>
> Signed-off-by: Jens Axboe <axboe@kernel.dk>

ack, and we want a "cherry-picked" from here when applying as usual.

> ---
>  drivers/block/loop.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/block/loop.c b/drivers/block/loop.c
> index b336433..c2ce03c 100644
> --- a/drivers/block/loop.c
> +++ b/drivers/block/loop.c
> @@ -1583,7 +1583,7 @@ static int lo_release(struct gendisk *disk, fmode_t mode)
>  		 * In autoclear mode, stop the loop thread
>  		 * and remove configuration after last close.
>  		 */
> -		err = loop_clr_fd(lo, NULL);
> +		err = loop_clr_fd(lo, lo->lo_device);
>  		if (!err)
>  			goto out_unlocked;
>  	} else {
> -- 
> 1.7.5.4
> 

> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
Tim Gardner Jan. 19, 2012, 4:25 p.m. UTC | #3
On 01/18/2012 08:46 AM, Ayan George wrote:
>
> SRU Justification:
>
> Impact: The loop device does not emit a change uevent when autoreleasing
> a device.  Programs that depend on uevents (like gvfs and ultimately
> Nautilus) never notice when loop devices are unmounted.
>
> Bug-Link: https://bugs.launchpad.net/ubuntu/+source/usb-creator/+bug/548546
>
> Fix: Apply 8a9c594422ecad912d6470888acdee9a1236ad68 from linux mainline
> -- Pass a valid bdev pointer to loop_clr_fd() instead of NULL so that
> it will emit the uevent.
>
> The patch is very small and applies cleanly to ubuntu-oneiric.
>
> Testcase:
>
> (1) In a terminal, start udevadm in monitor mode:
>
>    $ udevadm monitor
>
> (2) In another terminal, mount an ISO image using the loopback device:
>
>    $ sudo mount -o loop -t iso9660 your_image.iso /mnt
>
> (3) Notice the change uevents that udevadm reports.
>
> (4) Unmount image:
>
>    $ sudo umount /mnt
>
> (5) Note that udevadm does not report any changes.  With the patch
> applied, you will see the kernel noticiations.
>
>
>
>
>
diff mbox

Patch

From 8a9c594422ecad912d6470888acdee9a1236ad68 Mon Sep 17 00:00:00 2001
From: Phillip Susi <psusi@cfl.rr.com>
Date: Wed, 21 Sep 2011 10:02:13 +0200
Subject: [PATCH] drivers/block/loop.c: emit uevent on auto release

The loopback driver failed to emit the change uevent when auto releasing
the device.  Fixed lo_release() to pass the bdev to loop_clr_fd() so it
can emit the event.

Signed-off-by: Phillip Susi <psusi@cfl.rr.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Ayan George <ayan@ayan.net>
Signed-off-by: Andrew Morton <akpm@google.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 drivers/block/loop.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index b336433..c2ce03c 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1583,7 +1583,7 @@  static int lo_release(struct gendisk *disk, fmode_t mode)
 		 * In autoclear mode, stop the loop thread
 		 * and remove configuration after last close.
 		 */
-		err = loop_clr_fd(lo, NULL);
+		err = loop_clr_fd(lo, lo->lo_device);
 		if (!err)
 			goto out_unlocked;
 	} else {
-- 
1.7.5.4