Re: Tmpfs and loop device don't get along

Christoph Rohland (cr@sap.com)
Sat, 02 Feb 2002 10:48:14 +0100


Hi Andrew,

On Fri, 1 Feb 2002, Andrew Tipton wrote:
> If I have an image (initrd.img for example) located on a tmpfs
> filesystem, when I attempt to mount it:
>
> % mount -o loop /initrd.img /mnt
> ioctl: LOOP_SET_FD: Invalid argument

In the latest 2.4 sources you will find a file
Documentation/filesystems/tmpfs.txt which describes this problem.

> What is the best way to fix this short-term? I could bypass the
> readpage check in loop_set_fd, or I could add a dummy readpage entry
> to the address_space_operations struct for tmpfs. Would either of
> these have serious repercussions?

I do not see an easy and clean way so far. The check for readpage is
definitely needed. loop.c does rely on generic_file_{read,write} and
not on the files read and write operations. So IMHO the cleanest way
is to provide readpage et.al. in shmem.c and use generic_file_{read,write}
instead of specialized shmem_{read,write} functions. Unfortunately
this would mean a nontrivial change to the readpage semantics.

Greetings
Christoph

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/