[PATCH] 2.2.X fix ext2 socket filetype

From: Andreas Dilger (adilger@turbolabs.com)
Date: Sat May 27 2000 - 14:06:03 EST


Alan,
can you please add the following patch into the 2.2.16-pre tree. It is a
back-port of a fix in 2.3 which adds the missing de->file_type information
for sockets in ext2. Without this patch, e2fsck complains about all
of the inodes in the filesystem that are sockets because the filetype
hasn't been set. This is easily seen after a crash and e2fsck on /tmp
when X/Enlightenment/Gnome have been running, since they create a lot of
named sockets.

Cheers, Andreas
---- cut here ----
diff -u linux-2.2.14/fs/ext2/namei.c linux-2.2.14a/fs/ext2/namei.c
--- linux-2.2.14/fs/ext2/namei.c.orig Tue Jan 4 11:12:23 2000
+++ linux-2.2.14a/fs/ext2/namei.c Thu Apr 27 12:50:33 2000
@@ -418,6 +418,10 @@
                 if (EXT2_HAS_INCOMPAT_FEATURE(dir->i_sb,
                                               EXT2_FEATURE_INCOMPAT_FILETYPE))
                         de->file_type = EXT2_FT_REG_FILE;
+ } else if (S_ISSOCK(inode->i_mode)) {
+ if (EXT2_HAS_INCOMPAT_FEATURE(dir->i_sb,
+ EXT2_FEATURE_INCOMPAT_FILETYPE))
+ de->file_type = EXT2_FT_SOCK;
         } else if (S_ISCHR(inode->i_mode)) {
                 inode->i_op = &chrdev_inode_operations;
                 if (EXT2_HAS_INCOMPAT_FEATURE(dir->i_sb,
@@ -793,6 +798,8 @@
                         de->file_type = EXT2_FT_DIR;
                 else if (S_ISLNK(inode->i_mode))
                         de->file_type = EXT2_FT_SYMLINK;
+ else if (S_ISSOCK(inode->i_mode))
+ de->file_type = EXT2_FT_SOCK;
                 else if (S_ISCHR(inode->i_mode))
                         de->file_type = EXT2_FT_CHRDEV;
                 else if (S_ISBLK(inode->i_mode))
---- cut here ----

-- 
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

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed May 31 2000 - 21:00:18 EST