Re: losetuping files in tmpfs fails?

From: Andreas Dilger (
Date: Thu Jan 03 2002 - 18:42:46 EST

On Jan 03, 2002 15:10 -0800, Andrew Morton wrote:
> Andy Gaynor wrote:
> > Whilst trying to figure out why my dang stripes won't persist (a separate
> > but worrisome issue), I wrote a dittie which creates a couple junk files in
> > /tmp (tmpfs), associates loop devices with them, whoops, losetup craps out.
> >
> > ...
> > /tmp# mount | grep tmp # Filesystem is ...
> > tmpfs on /tmp type tmpfs (rw) # tmpfs
> > /tmp# echo foo > foo # Create file foo
> > /tmp# losetup /dev/loop/5 foo # Give foo to /dev/loop/5
> > ioctl: LOOP_SET_FD: Invalid argument # DISCO!!! <o > <o >
> Yup, tmpfs doesn't provide some of the facilities which the
> loop driver requires. Specifically, prepare_write() and
> commit_write().
> Probably it's not too hard to change loop to use generic_file_write(),
> and it will then permit tmpfs file-backed loop mounts.
> It's not obvious that there's a burning need to support loop-on-tmpfs
> though, is there?

Well, if you are using tmpfs as your /tmp filesystem (presumably not
such a strange situation given the name ;-), then any tool which creates
a loopback in /tmp will break. Good examples would be mkinitrd, or
anything that is generating a floppy image (e.g. Linux Router Project
floppy, boot floppy tools, etc).

Cheers, Andreas

Andreas Dilger

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to More majordomo info at Please read the FAQ at

This archive was generated by hypermail 2b29 : Mon Jan 07 2002 - 21:00:23 EST