#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;
#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,
.get_unmapped_area = EIO_ERROR,
};
-struct inode_operations bad_inode_ops =
+static struct inode_operations bad_inode_ops =
{
.create = EIO_ERROR,
.lookup = EIO_ERROR,
.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,
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;
}