2001-07-20 11:44:25

by Marc-Jano Knopp

[permalink] [raw]
Subject: 2.4.6: chattr / lsattr does not work on directories anymore!

Since kernel 2.4.6, the commands 'lsattr' and 'chattr' do not work
anymore when applied to directories:

As root:

# mkdir x
# chattr +i x
chattr: Inappropriate ioctl for device while reading flags on x
# lsattr -d x
lsattr: Inappropriate ioctl for device While reading flags on x
#

The error message also appears when I try to get or set any of the
other ext2 flags. I need the ext2 immutable flag to protect some
of the directories on my system against accidental deletion (be it
my fault or a buggy program).

Kernels < 2.2.6 and 2.2.18 work fine.


Best regards,

Marc-Jano


--
http://mjk.c64.org/


2001-07-20 15:08:28

by Andreas Dilger

[permalink] [raw]
Subject: Re: 2.4.6: chattr / lsattr does not work on directories anymore!

You write:
> Since kernel 2.4.6, the commands 'lsattr' and 'chattr' do not work
> anymore when applied to directories:
>
> As root:
>
> # mkdir x
> # chattr +i x
> chattr: Inappropriate ioctl for device while reading flags on x
> # lsattr -d x
> lsattr: Inappropriate ioctl for device While reading flags on x

This is fixed in the most recent Linus and -ac kernels. The fix is below.

Cheers, Andreas
==========================================================================
--- linux-2.4.6.orig/fs/ext2/dir.c Thu Jun 28 14:28:24 2001
+++ linux-2.4.6-aed/fs/ext2/dir.c Tue Jul 10 22:59:12 2001
@@ -576,5 +576,6 @@
struct file_operations ext2_dir_operations = {
read: generic_read_dir,
readdir: ext2_readdir,
+ ioctl: ext2_ioctl,
fsync: ext2_sync_file,
};
--
Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto,
\ would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/ -- Dogbert