Skip to content

Commit

Permalink
[PATCH] drivers/block/loop.c: don't return garbage if LOOP_SET_STATUS…
Browse files Browse the repository at this point in the history
… not called

While writing a version of losetup, I ran into the problem that the loop
device was returning total garbage.

It turns out the problem was that this losetup was only issuing the
LOOP_SET_FD ioctl and not issuing a subsequent LOOP_SET_STATUS ioctl.  This
losetup didn't have any special status to set, so it left out the call.

The deeper cause is that loop_set_fd sets the transfer function to NULL,
which causes no transfer to happen lo_do_transfer.

This patch fixes the problem by setting transfer to transfer_none in
loop_set_fd.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
csapuntz authored and Linus Torvalds committed Jun 23, 2006
1 parent 98bd34e commit eefe85e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/block/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file,
lo->lo_device = bdev;
lo->lo_flags = lo_flags;
lo->lo_backing_file = file;
lo->transfer = NULL;
lo->transfer = transfer_none;
lo->ioctl = NULL;
lo->lo_sizelimit = 0;
lo->old_gfp_mask = mapping_gfp_mask(mapping);
Expand Down

0 comments on commit eefe85e

Please sign in to comment.