Merge branches 'work.misc' and 'work.dcache' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull misc vfs updates from Al Viro: "Misc cleanups from various folks all over the place I expected more fs/dcache.c cleanups this cycle, so that went into a separate branch. Said cleanups have missed the window, so in the hindsight it could've gone into work.misc instead. Decided not to cherry-pick, thus the 'work.dcache' branch" * 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: fs: dcache: Use true and false for boolean values fold generic_readlink() into its only caller fs: shave 8 bytes off of struct inode fs: Add more kernel-doc to the produced documentation fs: Fix attr.c kernel-doc removed extra extern file_fdatawait_range * 'work.dcache' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: kill dentry_update_name_case()
This commit is contained in:
36
fs/namei.c
36
fs/namei.c
@@ -4655,29 +4655,6 @@ out:
|
||||
return len;
|
||||
}
|
||||
|
||||
/*
|
||||
* A helper for ->readlink(). This should be used *ONLY* for symlinks that
|
||||
* have ->get_link() not calling nd_jump_link(). Using (or not using) it
|
||||
* for any given inode is up to filesystem.
|
||||
*/
|
||||
static int generic_readlink(struct dentry *dentry, char __user *buffer,
|
||||
int buflen)
|
||||
{
|
||||
DEFINE_DELAYED_CALL(done);
|
||||
struct inode *inode = d_inode(dentry);
|
||||
const char *link = inode->i_link;
|
||||
int res;
|
||||
|
||||
if (!link) {
|
||||
link = inode->i_op->get_link(dentry, inode, &done);
|
||||
if (IS_ERR(link))
|
||||
return PTR_ERR(link);
|
||||
}
|
||||
res = readlink_copy(buffer, buflen, link);
|
||||
do_delayed_call(&done);
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* vfs_readlink - copy symlink body into userspace buffer
|
||||
* @dentry: dentry on which to get symbolic link
|
||||
@@ -4691,6 +4668,9 @@ static int generic_readlink(struct dentry *dentry, char __user *buffer,
|
||||
int vfs_readlink(struct dentry *dentry, char __user *buffer, int buflen)
|
||||
{
|
||||
struct inode *inode = d_inode(dentry);
|
||||
DEFINE_DELAYED_CALL(done);
|
||||
const char *link;
|
||||
int res;
|
||||
|
||||
if (unlikely(!(inode->i_opflags & IOP_DEFAULT_READLINK))) {
|
||||
if (unlikely(inode->i_op->readlink))
|
||||
@@ -4704,7 +4684,15 @@ int vfs_readlink(struct dentry *dentry, char __user *buffer, int buflen)
|
||||
spin_unlock(&inode->i_lock);
|
||||
}
|
||||
|
||||
return generic_readlink(dentry, buffer, buflen);
|
||||
link = inode->i_link;
|
||||
if (!link) {
|
||||
link = inode->i_op->get_link(dentry, inode, &done);
|
||||
if (IS_ERR(link))
|
||||
return PTR_ERR(link);
|
||||
}
|
||||
res = readlink_copy(buffer, buflen, link);
|
||||
do_delayed_call(&done);
|
||||
return res;
|
||||
}
|
||||
EXPORT_SYMBOL(vfs_readlink);
|
||||
|
||||
|
Reference in New Issue
Block a user