* linux-2.6.25: 'mkdir -p' does not work with rootdir as mount point inside a read only filesystem @ 2008-04-30 14:50 Lothar Waßmann 2008-05-02 4:52 ` Andrew Morton 0 siblings, 1 reply; 11+ messages in thread From: Lothar Waßmann @ 2008-04-30 14:50 UTC (permalink / raw) To: linux-kernel [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 1472 bytes --] Hi, when trying to create a directory path with 'mkdir -p' with the root being a mount point of a writeable filesystem that exists inside a read-only file system, mkdir return -EROFS. This was tested with the latest git-tree from: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 The last kernel I know of this has been working was 2.6.22. E.g.: |root@triton1:/# mount |rootfs on / type rootfs (rw) |/dev/root on / type jffs2 (ro) |proc on /proc type proc (rw) |sysfs on /sys type sysfs (rw) |/dev/root on /dev/.static/dev type jffs2 (ro) |tmpfs on /dev type tmpfs (rw,size=10240k,mode=755) |tmpfs on /var type tmpfs (rw) |tmpfs on /tmp type tmpfs (rw) |devpts on /dev/pts type devpts (rw,gid=5,mode=620) |tmpfs on /dev/shm type tmpfs (rw) |root@triton1:/# mkdir -p /dev/.udev/db |mkdir: Cannot create directory `/dev/': Read-only file system While: |root@triton1:/# cd /dev |root@triton1:/# mkdir -p .udev/db works as expected... Has anyone else encountered this problem already? I've searched the archives but could not find anything related to this problem. Lothar Waßmann -- ___________________________________________________________ Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10 Geschäftsführer: Matthias Kaussen Handelsregistereintrag: Amtsgericht Aachen, HRB 4996 www.karo-electronics.de | info@karo-electronics.de ___________________________________________________________ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: linux-2.6.25: 'mkdir -p' does not work with rootdir as mount point inside a read only filesystem 2008-04-30 14:50 linux-2.6.25: 'mkdir -p' does not work with rootdir as mount point inside a read only filesystem Lothar Waßmann @ 2008-05-02 4:52 ` Andrew Morton 2008-05-02 6:55 ` NeilBrown 2008-05-02 11:32 ` Dan Noé 0 siblings, 2 replies; 11+ messages in thread From: Andrew Morton @ 2008-05-02 4:52 UTC (permalink / raw) To: Lothar Waßmann; +Cc: linux-kernel On Wed, 30 Apr 2008 16:50:20 +0200 Lothar Wa__mann <LW@KARO-electronics.de> wrote: > Hi, (y'know that ~4000 people read your email and hit 'n'? Except for me? That's one bug I'd like to get fixed) > when trying to create a directory path with 'mkdir -p' with the root > being a mount point of a writeable filesystem that exists inside a > read-only file system, mkdir return -EROFS. > > This was tested with the latest git-tree from: > git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 > > The last kernel I know of this has been working was 2.6.22. > > E.g.: > |root@triton1:/# mount > |rootfs on / type rootfs (rw) > |/dev/root on / type jffs2 (ro) > |proc on /proc type proc (rw) > |sysfs on /sys type sysfs (rw) > |/dev/root on /dev/.static/dev type jffs2 (ro) > |tmpfs on /dev type tmpfs (rw,size=10240k,mode=755) > |tmpfs on /var type tmpfs (rw) > |tmpfs on /tmp type tmpfs (rw) > |devpts on /dev/pts type devpts (rw,gid=5,mode=620) > |tmpfs on /dev/shm type tmpfs (rw) > |root@triton1:/# mkdir -p /dev/.udev/db > |mkdir: Cannot create directory `/dev/': Read-only file system > > While: > |root@triton1:/# cd /dev > |root@triton1:/# mkdir -p .udev/db > works as expected... > > Has anyone else encountered this problem already? > I've searched the archives but could not find anything related to this > problem. I had a shot at scripting this, but for me, everything works OK. #!/bin/sh dd if=/dev/zero of=file1 bs=1M count=32 dd if=/dev/zero of=file2 bs=1M count=32 yes | mkfs -t ext2 file1 yes | mkfs -t ext2 file2 mkdir -p mountpoint mount -o loop file1 mountpoint mkdir mountpoint/dir umount mountpoint mount -o loop,ro file1 mountpoint mount -o loop file2 mountpoint/dir mkdir -p $(/bin/pwd)/mountpoint/dir/subdir are you able to modify the above so that it demonstrates the failure? Thanks. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: linux-2.6.25: 'mkdir -p' does not work with rootdir as mount point inside a read only filesystem 2008-05-02 4:52 ` Andrew Morton @ 2008-05-02 6:55 ` NeilBrown 2008-05-03 6:32 ` Willy Tarreau 2008-05-02 11:32 ` Dan Noé 1 sibling, 1 reply; 11+ messages in thread From: NeilBrown @ 2008-05-02 6:55 UTC (permalink / raw) To: Andrew Morton; +Cc: Lothar Waßmann, linux-kernel On Fri, May 2, 2008 2:52 pm, Andrew Morton wrote: > On Wed, 30 Apr 2008 16:50:20 +0200 Lothar Wa__mann > <LW@KARO-electronics.de> wrote: > >> Hi, > > (y'know that ~4000 people read your email and hit 'n'? Except for me? > That's one bug I'd like to get fixed) Tricky.... > >> when trying to create a directory path with 'mkdir -p' with the root >> being a mount point of a writeable filesystem that exists inside a >> read-only file system, mkdir return -EROFS. My guess is that you have an old/buggy version of mkdir. What does mkdir --version say? Mine says: mkdir (GNU coreutils) 6.10 Copyright (C) 2008 Free Software Foundation, Inc. etc... What does strace mkdir -p /dev/.udev/db show ??? NeilBrown ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: linux-2.6.25: 'mkdir -p' does not work with rootdir as mount point inside a read only filesystem 2008-05-02 6:55 ` NeilBrown @ 2008-05-03 6:32 ` Willy Tarreau 2008-05-05 6:27 ` Lothar Waßmann 0 siblings, 1 reply; 11+ messages in thread From: Willy Tarreau @ 2008-05-03 6:32 UTC (permalink / raw) To: NeilBrown; +Cc: Andrew Morton, Lothar Waßmann, linux-kernel On Fri, May 02, 2008 at 04:55:43PM +1000, NeilBrown wrote: > On Fri, May 2, 2008 2:52 pm, Andrew Morton wrote: > > On Wed, 30 Apr 2008 16:50:20 +0200 Lothar Wa__mann > > <LW@KARO-electronics.de> wrote: > > > >> Hi, > > > > (y'know that ~4000 people read your email and hit 'n'? Except for me? > > That's one bug I'd like to get fixed) > > Tricky.... > > > > >> when trying to create a directory path with 'mkdir -p' with the root > >> being a mount point of a writeable filesystem that exists inside a > >> read-only file system, mkdir return -EROFS. > > My guess is that you have an old/buggy version of mkdir. > > What does > mkdir --version > > say? > Mine says: > mkdir (GNU coreutils) 6.10 > Copyright (C) 2008 Free Software Foundation, Inc. > etc... I would bet this is the problem for the reporter. I tried the same here, and cannot exhibit the problem. Just like the reporter, my / is ro and /dev is rw : # mkdir --version mkdir (coreutils) 5.2.1 ... # uname -a Linux alix-2C3 2.6.25-wt4-alix #3 Thu Apr 24 08:30:05 CEST 2008 i586 i586 i386 GNU/Linux (this is essentially 2.6.25+squashfs+some geode patches) # mount /dev/sda4 on / type ext3 (ro,errors=continue,data=ordered) /dev on /dev type tmpfs (rw,size=0k,nr_inodes=4096,mode=755) # mkdir -p /dev/a/b/c # ls -lad /dev/a/b/c drwxr-xr-x 2 root root 40 Jan 3 00:49 /dev/a/b/c/ # rmdir -p /dev/a/b/c rmdir: `/dev': Read-only file system # strace mkdir -p /dev/a/b/c stat64("/dev/a/b/c", 0xbf9175dc) = -1 ENOENT (No such file or directory) umask(0) = 022 open(".", O_RDONLY|O_LARGEFILE|O_DIRECTORY) = 3 chdir("/") = 0 mkdir("dev", 0755) = -1 EEXIST (File exists) stat64("dev", {st_mode=S_IFDIR|0755, st_size=17080, ...}) = 0 chdir("dev") = 0 mkdir("a", 0755) = 0 chdir("a") = 0 mkdir("b", 0755) = 0 chdir("b") = 0 umask(022) = 0 mkdir("c", 0777) = 0 fchdir(3) = 0 close(3) = 0 Regards, Willy ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: linux-2.6.25: 'mkdir -p' does not work with rootdir as mount point inside a read only filesystem 2008-05-03 6:32 ` Willy Tarreau @ 2008-05-05 6:27 ` Lothar Waßmann 2008-05-05 7:02 ` Willy Tarreau 0 siblings, 1 reply; 11+ messages in thread From: Lothar Waßmann @ 2008-05-05 6:27 UTC (permalink / raw) To: Willy Tarreau; +Cc: NeilBrown, Andrew Morton, linux-kernel [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 2196 bytes --] Hi, Willy Tarreau writes: > > My guess is that you have an old/buggy version of mkdir. > > > > What does > > mkdir --version > > > > say? > > Mine says: > > mkdir (GNU coreutils) 6.10 > > Copyright (C) 2008 Free Software Foundation, Inc. > > etc... > > I would bet this is the problem for the reporter. > > I tried the same here, and cannot exhibit the problem. Just like the > reporter, my / is ro and /dev is rw : > I'm using busybox 1.0 (on an embedded PXA320 system). > stat64("/dev/a/b/c", 0xbf9175dc) = -1 ENOENT (No such file or directory) > umask(0) = 022 > open(".", O_RDONLY|O_LARGEFILE|O_DIRECTORY) = 3 > chdir("/") = 0 > mkdir("dev", 0755) = -1 EEXIST (File exists) > stat64("dev", {st_mode=S_IFDIR|0755, st_size=17080, ...}) = 0 > chdir("dev") = 0 > mkdir("a", 0755) = 0 > chdir("a") = 0 > mkdir("b", 0755) = 0 > chdir("b") = 0 > umask(022) = 0 > mkdir("c", 0777) = 0 > fchdir(3) = 0 > close(3) = 0 > This is what strace shows in my case: mkdir("/", 0777) = -1 EEXIST (File exists) stat64("/", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 mkdir("/dev/", 0777) = -1 EROFS (Read-only file system) umask(022) = 022 write(2, "mkdir: ", 7mkdir: ) = 7 write(2, "Cannot create directory `/dev/\'", 31Cannot create directory `/dev/') = 31 write(2, ": Read-only file system\n", 24: Read-only file system ) = 24 io_submit(0x1, 0x1, 0xfbad2088 <unfinished ... exit status 1> Lothar Waßmann -- ___________________________________________________________ Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10 Geschäftsführer: Matthias Kaussen Handelsregistereintrag: Amtsgericht Aachen, HRB 4996 www.karo-electronics.de | info@karo-electronics.de ___________________________________________________________ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: linux-2.6.25: 'mkdir -p' does not work with rootdir as mount point inside a read only filesystem 2008-05-05 6:27 ` Lothar Waßmann @ 2008-05-05 7:02 ` Willy Tarreau 2008-05-05 7:08 ` Lothar Waßmann 0 siblings, 1 reply; 11+ messages in thread From: Willy Tarreau @ 2008-05-05 7:02 UTC (permalink / raw) To: Lothar Waßmann; +Cc: NeilBrown, Andrew Morton, linux-kernel On Mon, May 05, 2008 at 08:27:57AM +0200, Lothar Waßmann wrote: > I'm using busybox 1.0 (on an embedded PXA320 system). OK > > stat64("/dev/a/b/c", 0xbf9175dc) = -1 ENOENT (No such file or directory) > > umask(0) = 022 > > open(".", O_RDONLY|O_LARGEFILE|O_DIRECTORY) = 3 > > chdir("/") = 0 > > mkdir("dev", 0755) = -1 EEXIST (File exists) > > stat64("dev", {st_mode=S_IFDIR|0755, st_size=17080, ...}) = 0 > > chdir("dev") = 0 > > mkdir("a", 0755) = 0 > > chdir("a") = 0 > > mkdir("b", 0755) = 0 > > chdir("b") = 0 > > umask(022) = 0 > > mkdir("c", 0777) = 0 > > fchdir(3) = 0 > > close(3) = 0 > > > This is what strace shows in my case: > mkdir("/", 0777) = -1 EEXIST (File exists) > stat64("/", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 > mkdir("/dev/", 0777) = -1 EROFS (Read-only file system) > umask(022) = 022 > write(2, "mkdir: ", 7mkdir: ) = 7 > write(2, "Cannot create directory `/dev/\'", 31Cannot create directory `/dev/') = 31 > write(2, ": Read-only file system\n", 24: Read-only file system > ) = 24 > io_submit(0x1, 0x1, 0xfbad2088 <unfinished ... exit status 1> So you should send this trace to the busybox maintainer. It obviously exhibits a small but easily fixable bug in the program ; it should check whether the directory exists in case of error. It seems it only checks for EEXIST. What puzzles me is why you have this problem only with a new kernel. I suspect that previous ones did report EEXIST and now we report EROFS for an existing directory on an ro fs. Willy ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: linux-2.6.25: 'mkdir -p' does not work with rootdir as mount point inside a read only filesystem 2008-05-05 7:02 ` Willy Tarreau @ 2008-05-05 7:08 ` Lothar Waßmann 2008-05-05 7:28 ` Willy Tarreau 0 siblings, 1 reply; 11+ messages in thread From: Lothar Waßmann @ 2008-05-05 7:08 UTC (permalink / raw) To: Willy Tarreau; +Cc: NeilBrown, Andrew Morton, linux-kernel [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 1236 bytes --] Hi, Willy Tarreau writes: > > > open(".", O_RDONLY|O_LARGEFILE|O_DIRECTORY) = 3 > > > chdir("/") = 0 > > > mkdir("dev", 0755) = -1 EEXIST (File exists) ^^^^^^ [...] > > This is what strace shows in my case: > > mkdir("/", 0777) = -1 EEXIST (File exists) > > stat64("/", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 > > mkdir("/dev/", 0777) = -1 EROFS (Read-only file system) ^^^^^ > What puzzles me is why you have this problem only with a new kernel. > I suspect that previous ones did report EEXIST and now we report > EROFS for an existing directory on an ro fs. > Interestingly your strace output showed a return value of EEXIST where mine had EROFS. Lothar Waßmann -- ___________________________________________________________ Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10 Geschäftsführer: Matthias Kaussen Handelsregistereintrag: Amtsgericht Aachen, HRB 4996 www.karo-electronics.de | info@karo-electronics.de ___________________________________________________________ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: linux-2.6.25: 'mkdir -p' does not work with rootdir as mount point inside a read only filesystem 2008-05-05 7:08 ` Lothar Waßmann @ 2008-05-05 7:28 ` Willy Tarreau 2008-05-05 7:38 ` Lothar Waßmann 0 siblings, 1 reply; 11+ messages in thread From: Willy Tarreau @ 2008-05-05 7:28 UTC (permalink / raw) To: Lothar Waßmann; +Cc: NeilBrown, Andrew Morton, linux-kernel On Mon, May 05, 2008 at 09:08:00AM +0200, Lothar Waßmann wrote: > Hi, > > Willy Tarreau writes: > > > > open(".", O_RDONLY|O_LARGEFILE|O_DIRECTORY) = 3 > > > > chdir("/") = 0 > > > > mkdir("dev", 0755) = -1 EEXIST (File exists) > ^^^^^^ > [...] > > > This is what strace shows in my case: > > > mkdir("/", 0777) = -1 EEXIST (File exists) > > > stat64("/", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 > > > mkdir("/dev/", 0777) = -1 EROFS (Read-only file system) > ^^^^^ > > What puzzles me is why you have this problem only with a new kernel. > > I suspect that previous ones did report EEXIST and now we report > > EROFS for an existing directory on an ro fs. > > > Interestingly your strace output showed a return value of EEXIST where > mine had EROFS. Oh you're right! I did not notice. There's something odd here. And I can reproduce it right now (2.6.25.1). I really have EEXIST. Willy ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: linux-2.6.25: 'mkdir -p' does not work with rootdir as mount point inside a read only filesystem 2008-05-05 7:28 ` Willy Tarreau @ 2008-05-05 7:38 ` Lothar Waßmann 2008-05-05 12:02 ` Al Viro 0 siblings, 1 reply; 11+ messages in thread From: Lothar Waßmann @ 2008-05-05 7:38 UTC (permalink / raw) To: Willy Tarreau; +Cc: NeilBrown, Andrew Morton, linux-kernel [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 981 bytes --] Hi, Willy Tarreau writes: > > Interestingly your strace output showed a return value of EEXIST where > > mine had EROFS. > > Oh you're right! I did not notice. There's something odd here. > And I can reproduce it right now (2.6.25.1). I really have > EEXIST. > As I noted in my first message I have this problem with the kernel from git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 which is currently 2.6.26-rc1 and still exhibits this behaviour. So, this problem obviously does not exist in the 2.6.25 release kernel but would probably hit mainline in the 2.6.26 release. Lothar Waßmann -- ___________________________________________________________ Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10 Geschäftsführer: Matthias Kaussen Handelsregistereintrag: Amtsgericht Aachen, HRB 4996 www.karo-electronics.de | info@karo-electronics.de ___________________________________________________________ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: linux-2.6.25: 'mkdir -p' does not work with rootdir as mount point inside a read only filesystem 2008-05-05 7:38 ` Lothar Waßmann @ 2008-05-05 12:02 ` Al Viro 0 siblings, 0 replies; 11+ messages in thread From: Al Viro @ 2008-05-05 12:02 UTC (permalink / raw) To: Lothar Wa?mann; +Cc: Willy Tarreau, NeilBrown, Andrew Morton, linux-kernel, hch On Mon, May 05, 2008 at 09:38:57AM +0200, Lothar Wa?mann wrote: > Hi, > > Willy Tarreau writes: > > > Interestingly your strace output showed a return value of EEXIST where > > > mine had EROFS. > > > > Oh you're right! I did not notice. There's something odd here. > > And I can reproduce it right now (2.6.25.1). I really have > > EEXIST. > > > As I noted in my first message I have this problem with the kernel > from git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 > which is currently 2.6.26-rc1 and still exhibits this behaviour. > > So, this problem obviously does not exist in the 2.6.25 release kernel > but would probably hit mainline in the 2.6.26 release. Aye. That's ro-bind fallout we'd not noticed; will fix... And a fine example of the reasons why * relying on which particular errno value you get when several are applicable is a Bad Idea(tm) and * changing the choice of the errno value in such situation might be legal, but is to be done with care; sometimes it really has impact... ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: linux-2.6.25: 'mkdir -p' does not work with rootdir as mount point inside a read only filesystem 2008-05-02 4:52 ` Andrew Morton 2008-05-02 6:55 ` NeilBrown @ 2008-05-02 11:32 ` Dan Noé 1 sibling, 0 replies; 11+ messages in thread From: Dan Noé @ 2008-05-02 11:32 UTC (permalink / raw) To: Andrew Morton; +Cc: Lothar Waßmann, linux-kernel Andrew Morton wrote: >> |root@triton1:/# mount >> |rootfs on / type rootfs (rw) >> |/dev/root on / type jffs2 (ro) >> |proc on /proc type proc (rw) >> |sysfs on /sys type sysfs (rw) >> |/dev/root on /dev/.static/dev type jffs2 (ro) >> |tmpfs on /dev type tmpfs (rw,size=10240k,mode=755) >> |tmpfs on /var type tmpfs (rw) >> |tmpfs on /tmp type tmpfs (rw) >> |devpts on /dev/pts type devpts (rw,gid=5,mode=620) >> |tmpfs on /dev/shm type tmpfs (rw) >> |root@triton1:/# mkdir -p /dev/.udev/db >> |mkdir: Cannot create directory `/dev/': Read-only file system >> >> While: >> |root@triton1:/# cd /dev >> |root@triton1:/# mkdir -p .udev/db >> works as expected... >> >> Has anyone else encountered this problem already? >> I've searched the archives but could not find anything related to this >> problem. > > I had a shot at scripting this, but for me, everything works OK. > > #!/bin/sh > dd if=/dev/zero of=file1 bs=1M count=32 > dd if=/dev/zero of=file2 bs=1M count=32 > yes | mkfs -t ext2 file1 > yes | mkfs -t ext2 file2 > mkdir -p mountpoint > mount -o loop file1 mountpoint > mkdir mountpoint/dir > umount mountpoint > mount -o loop,ro file1 mountpoint > mount -o loop file2 mountpoint/dir > mkdir -p $(/bin/pwd)/mountpoint/dir/subdir Hmmm. The thing you are doing differently is that the reporter's root filesystem is mounted read only but in your case (and the quick try I had at it) the read only file system is mounted below root. However, I tried reproducing that scenario with a chroot and I still couldn't get it to happen. No time to try a real root mount ro this morning but perhaps others can. Cheers, Dan -- /--------------- - - - - - - | Dan Noé | http://isomerica.net/~dpn/ ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2008-05-05 12:02 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-04-30 14:50 linux-2.6.25: 'mkdir -p' does not work with rootdir as mount point inside a read only filesystem Lothar Waßmann 2008-05-02 4:52 ` Andrew Morton 2008-05-02 6:55 ` NeilBrown 2008-05-03 6:32 ` Willy Tarreau 2008-05-05 6:27 ` Lothar Waßmann 2008-05-05 7:02 ` Willy Tarreau 2008-05-05 7:08 ` Lothar Waßmann 2008-05-05 7:28 ` Willy Tarreau 2008-05-05 7:38 ` Lothar Waßmann 2008-05-05 12:02 ` Al Viro 2008-05-02 11:32 ` Dan Noé
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox