2.4.0-test10 broke `dd' for block devices, due to the following
change to do_sys_truncate & do_sys_ftruncate:

diff -u --recursive --new-file v2.4.0-test9/linux/fs/open.c linux/fs/open.c
--- v2.4.0-test9/linux/fs/open.c        Sun Oct  8 10:50:33 2000
+++ linux/fs/open.c     Thu Oct 26 08:11:21 2000
@@ -103,7 +103,7 @@
        inode = nd.dentry->d_inode;
 
        error = -EACCES;
-       if (S_ISDIR(inode->i_mode))
+       if (!S_ISREG(inode->i_mode))
                goto dput_and_out;
 
        error = permission(inode,MAY_WRITE);
@@ -164,7 +164,7 @@
        dentry = file->f_dentry;
        inode = dentry->d_inode;
        error = -EACCES;
-       if (S_ISDIR(inode->i_mode) || !(file->f_mode & FMODE_WRITE))
+       if (!S_ISREG(inode->i_mode) || !(file->f_mode & FMODE_WRITE))
                goto out_putf;
        error = -EPERM;
        if (IS_IMMUTABLE(inode) || IS_APPEND(inode))

I noticed because I needed to build a boot floppy with an
initial ram disk under 2.4.0-test11pre5. The standard recipe
(Documentation/ramdisk.txt) basically goes:
- dd if=bzImage of=/dev/fd0 bs=1k
  notice how many blocks dd reported (NNN)
- dd if=ram_image of=/dev/fd0 bs=1k seek=NNN
dd implements the seek=NNN option by calling ftruncate() before
starting the write. This is where 2.4.0-test10 breaks, since
ftruncate on a block device now provokes an EACCES error.

Maybe `dd' is buggy and should use lseek() instead, but this has
apparently worked for a long time.

Does anyone know the reason for the S_ISDIR -> !S_ISREG change in test10?

/Mikael
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/

Reply via email to