Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / fs / bad_inode.c
index 3957ad1..80599ae 100644 (file)
 #include <linux/smp_lock.h>
 #include <linux/namei.h>
 
-/*
- * The follow_link operation is special: it must behave as a no-op
- * so that a bad root inode can at least be unmounted. To do this
- * we must dput() the base and return the dentry with a dget().
- */
-static int bad_follow_link(struct dentry *dent, struct nameidata *nd)
-{
-       nd_set_link(nd, ERR_PTR(-EIO));
-       return 0;
-}
-
 static int return_EIO(void)
 {
        return -EIO;
@@ -33,7 +22,7 @@ static int return_EIO(void)
 
 #define EIO_ERROR ((void *) (return_EIO))
 
-static struct file_operations bad_file_ops =
+static const struct file_operations bad_file_ops =
 {
        .llseek         = EIO_ERROR,
        .aio_read       = EIO_ERROR,
@@ -58,7 +47,7 @@ static struct file_operations bad_file_ops =
        .get_unmapped_area = EIO_ERROR,
 };
 
-struct inode_operations bad_inode_ops =
+static struct inode_operations bad_inode_ops =
 {
        .create         = EIO_ERROR,
        .lookup         = EIO_ERROR,
@@ -70,7 +59,8 @@ struct inode_operations bad_inode_ops =
        .mknod          = EIO_ERROR,
        .rename         = EIO_ERROR,
        .readlink       = EIO_ERROR,
-       .follow_link    = bad_follow_link,
+       /* follow_link must be no-op, otherwise unmounting this inode
+          won't work */
        .truncate       = EIO_ERROR,
        .permission     = EIO_ERROR,
        .getattr        = EIO_ERROR,
@@ -105,7 +95,8 @@ void make_bad_inode(struct inode * inode)
        remove_inode_hash(inode);
 
        inode->i_mode = S_IFREG;
-       inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+       inode->i_atime = inode->i_mtime = inode->i_ctime =
+               current_fs_time(inode->i_sb);
        inode->i_op = &bad_inode_ops;   
        inode->i_fop = &bad_file_ops;   
 }