From: "Andrew Tipton" <andrew@cadre5.com>
To: <linux-kernel@vger.kernel.org>
Subject: Tmpfs and loop device don't get along
Date: Fri, 1 Feb 2002 16:19:50 -0500 [thread overview]
Message-ID: <00fb01c1ab66$2fbc5490$6400a8c0@africa.cadre5.com> (raw)
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
After deciding that it was not due to lack of loop devices (/dev/loop0..7),
an unreadable file, and other common userspace causes, I dug through the
kernel sources. When calling LOOP_SET_FD, the single argument is the
filedescriptor of the file (/initrd.img). The loop_set_fd function (in
drivers/block/loop.c) first gets the inode entry for the file, and then the
address_space_operations struct for that inode. If there is no readpage
function in that struct, loop_set_fd fails with EINVAL. The reason for this
check is "if we can't read - sorry" -- apparently testing to see if it's
possible to read from the file/filesystem?
In the tmpfs source (mm/shmem.c), the address_space_operations struct for
this filesystem is defined. The struct (shmem_aops) is defined statically,
and the only member is writepage. readpage is missing, causing a guaranteed
failure in loop_set_fd.
Something smells wrong here (why does loop_set_fd care about
address_space_operations, and not file_operations? it only needs access to
the file....), but I don't know enough about the internal workings of the
page cache/vfs/etc to do much about it.
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'm not subscribed to the linux-kernel mailing list, so I would appreciate
it if you could CC all replies to me as well.
Thanks,
Andrew Tipton
Cadre5, LLC
next reply other threads:[~2002-02-01 21:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-02-01 21:19 Andrew Tipton [this message]
2002-02-02 9:48 ` Christoph Rohland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='00fb01c1ab66$2fbc5490$6400a8c0@africa.cadre5.com' \
--to=andrew@cadre5.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®