You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branch 'work.symlinks' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs RCU symlink updates from Al Viro: "Replacement of ->follow_link/->put_link, allowing to stay in RCU mode even if the symlink is not an embedded one. No changes since the mailbomb on Jan 1" * 'work.symlinks' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: switch ->get_link() to delayed_call, kill ->put_link() kill free_page_put_link() teach nfs_get_link() to work in RCU mode teach proc_self_get_link()/proc_thread_self_get_link() to work in RCU mode teach shmem_get_link() to work in RCU mode teach page_get_link() to work in RCU mode replace ->follow_link() with new method that could stay in RCU mode don't put symlink bodies in pagecache into highmem namei: page_getlink() and page_follow_link_light() are the same thing ufs: get rid of ->setattr() for symlinks udf: don't duplicate page_symlink_inode_operations logfs: don't duplicate page_symlink_inode_operations switch befs long symlinks to page_symlink_operations
This commit is contained in:
@@ -50,8 +50,7 @@ prototypes:
|
||||
int (*rename2) (struct inode *, struct dentry *,
|
||||
struct inode *, struct dentry *, unsigned int);
|
||||
int (*readlink) (struct dentry *, char __user *,int);
|
||||
const char *(*follow_link) (struct dentry *, void **);
|
||||
void (*put_link) (struct inode *, void *);
|
||||
const char *(*get_link) (struct dentry *, struct inode *, void **);
|
||||
void (*truncate) (struct inode *);
|
||||
int (*permission) (struct inode *, int, unsigned int);
|
||||
int (*get_acl)(struct inode *, int);
|
||||
@@ -83,8 +82,7 @@ rmdir: yes (both) (see below)
|
||||
rename: yes (all) (see below)
|
||||
rename2: yes (all) (see below)
|
||||
readlink: no
|
||||
follow_link: no
|
||||
put_link: no
|
||||
get_link: no
|
||||
setattr: yes
|
||||
permission: no (may not block if called in rcu-walk mode)
|
||||
get_acl: no
|
||||
|
||||
@@ -504,3 +504,20 @@ in your dentry operations instead.
|
||||
[mandatory]
|
||||
__fd_install() & fd_install() can now sleep. Callers should not
|
||||
hold a spinlock or other resources that do not allow a schedule.
|
||||
--
|
||||
[mandatory]
|
||||
any symlink that might use page_follow_link_light/page_put_link() must
|
||||
have inode_nohighmem(inode) called before anything might start playing with
|
||||
its pagecache.
|
||||
--
|
||||
[mandatory]
|
||||
->follow_link() is replaced with ->get_link(); same API, except that
|
||||
* ->get_link() gets inode as a separate argument
|
||||
* ->get_link() may be called in RCU mode - in that case NULL
|
||||
dentry is passed
|
||||
--
|
||||
[mandatory]
|
||||
->get_link() gets struct delayed_call *done now, and should do
|
||||
set_delayed_call() where it used to set *cookie.
|
||||
->put_link() is gone - just give the destructor to set_delayed_call()
|
||||
in ->get_link().
|
||||
|
||||
@@ -350,8 +350,8 @@ struct inode_operations {
|
||||
int (*rename2) (struct inode *, struct dentry *,
|
||||
struct inode *, struct dentry *, unsigned int);
|
||||
int (*readlink) (struct dentry *, char __user *,int);
|
||||
const char *(*follow_link) (struct dentry *, void **);
|
||||
void (*put_link) (struct inode *, void *);
|
||||
const char *(*get_link) (struct dentry *, struct inode *,
|
||||
struct delayed_call *);
|
||||
int (*permission) (struct inode *, int);
|
||||
int (*get_acl)(struct inode *, int);
|
||||
int (*setattr) (struct dentry *, struct iattr *);
|
||||
@@ -434,20 +434,19 @@ otherwise noted.
|
||||
readlink: called by the readlink(2) system call. Only required if
|
||||
you want to support reading symbolic links
|
||||
|
||||
follow_link: called by the VFS to follow a symbolic link to the
|
||||
get_link: called by the VFS to follow a symbolic link to the
|
||||
inode it points to. Only required if you want to support
|
||||
symbolic links. This method returns the symlink body
|
||||
to traverse (and possibly resets the current position with
|
||||
nd_jump_link()). If the body won't go away until the inode
|
||||
is gone, nothing else is needed; if it needs to be otherwise
|
||||
pinned, the data needed to release whatever we'd grabbed
|
||||
is to be stored in void * variable passed by address to
|
||||
follow_link() instance.
|
||||
|
||||
put_link: called by the VFS to release resources allocated by
|
||||
follow_link(). The cookie stored by follow_link() is passed
|
||||
to this method as the last parameter; only called when
|
||||
cookie isn't NULL.
|
||||
pinned, arrange for its release by having get_link(..., ..., done)
|
||||
do set_delayed_call(done, destructor, argument).
|
||||
In that case destructor(argument) will be called once VFS is
|
||||
done with the body you've returned.
|
||||
May be called in RCU mode; that is indicated by NULL dentry
|
||||
argument. If request can't be handled without leaving RCU mode,
|
||||
have it return ERR_PTR(-ECHILD).
|
||||
|
||||
permission: called by the VFS to check for access rights on a POSIX-like
|
||||
filesystem.
|
||||
|
||||
@@ -118,12 +118,20 @@ failed:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static const char *ll_follow_link(struct dentry *dentry, void **cookie)
|
||||
static void ll_put_link(void *p)
|
||||
{
|
||||
ptlrpc_req_finished(p);
|
||||
}
|
||||
|
||||
static const char *ll_get_link(struct dentry *dentry,
|
||||
struct inode *inode,
|
||||
struct delayed_call *done)
|
||||
{
|
||||
struct inode *inode = d_inode(dentry);
|
||||
struct ptlrpc_request *request = NULL;
|
||||
int rc;
|
||||
char *symname = NULL;
|
||||
if (!dentry)
|
||||
return ERR_PTR(-ECHILD);
|
||||
|
||||
CDEBUG(D_VFSTRACE, "VFS Op\n");
|
||||
ll_inode_size_lock(inode);
|
||||
@@ -135,22 +143,16 @@ static const char *ll_follow_link(struct dentry *dentry, void **cookie)
|
||||
}
|
||||
|
||||
/* symname may contain a pointer to the request message buffer,
|
||||
* we delay request releasing until ll_put_link then.
|
||||
* we delay request releasing then.
|
||||
*/
|
||||
*cookie = request;
|
||||
set_delayed_call(done, ll_put_link, request);
|
||||
return symname;
|
||||
}
|
||||
|
||||
static void ll_put_link(struct inode *unused, void *cookie)
|
||||
{
|
||||
ptlrpc_req_finished(cookie);
|
||||
}
|
||||
|
||||
struct inode_operations ll_fast_symlink_inode_operations = {
|
||||
.readlink = generic_readlink,
|
||||
.setattr = ll_setattr,
|
||||
.follow_link = ll_follow_link,
|
||||
.put_link = ll_put_link,
|
||||
.get_link = ll_get_link,
|
||||
.getattr = ll_getattr,
|
||||
.permission = ll_inode_permission,
|
||||
.setxattr = ll_setxattr,
|
||||
|
||||
+16
-8
@@ -1223,18 +1223,26 @@ ino_t v9fs_qid2ino(struct p9_qid *qid)
|
||||
}
|
||||
|
||||
/**
|
||||
* v9fs_vfs_follow_link - follow a symlink path
|
||||
* v9fs_vfs_get_link - follow a symlink path
|
||||
* @dentry: dentry for symlink
|
||||
* @cookie: place to pass the data to put_link()
|
||||
* @inode: inode for symlink
|
||||
* @done: delayed call for when we are done with the return value
|
||||
*/
|
||||
|
||||
static const char *v9fs_vfs_follow_link(struct dentry *dentry, void **cookie)
|
||||
static const char *v9fs_vfs_get_link(struct dentry *dentry,
|
||||
struct inode *inode,
|
||||
struct delayed_call *done)
|
||||
{
|
||||
struct v9fs_session_info *v9ses = v9fs_dentry2v9ses(dentry);
|
||||
struct p9_fid *fid = v9fs_fid_lookup(dentry);
|
||||
struct v9fs_session_info *v9ses;
|
||||
struct p9_fid *fid;
|
||||
struct p9_wstat *st;
|
||||
char *res;
|
||||
|
||||
if (!dentry)
|
||||
return ERR_PTR(-ECHILD);
|
||||
|
||||
v9ses = v9fs_dentry2v9ses(dentry);
|
||||
fid = v9fs_fid_lookup(dentry);
|
||||
p9_debug(P9_DEBUG_VFS, "%pd\n", dentry);
|
||||
|
||||
if (IS_ERR(fid))
|
||||
@@ -1259,7 +1267,8 @@ static const char *v9fs_vfs_follow_link(struct dentry *dentry, void **cookie)
|
||||
|
||||
p9stat_free(st);
|
||||
kfree(st);
|
||||
return *cookie = res;
|
||||
set_delayed_call(done, kfree_link, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1452,8 +1461,7 @@ static const struct inode_operations v9fs_file_inode_operations = {
|
||||
|
||||
static const struct inode_operations v9fs_symlink_inode_operations = {
|
||||
.readlink = generic_readlink,
|
||||
.follow_link = v9fs_vfs_follow_link,
|
||||
.put_link = kfree_put_link,
|
||||
.get_link = v9fs_vfs_get_link,
|
||||
.getattr = v9fs_vfs_getattr,
|
||||
.setattr = v9fs_vfs_setattr,
|
||||
};
|
||||
|
||||
+14
-7
@@ -899,26 +899,34 @@ error:
|
||||
}
|
||||
|
||||
/**
|
||||
* v9fs_vfs_follow_link_dotl - follow a symlink path
|
||||
* v9fs_vfs_get_link_dotl - follow a symlink path
|
||||
* @dentry: dentry for symlink
|
||||
* @cookie: place to pass the data to put_link()
|
||||
* @inode: inode for symlink
|
||||
* @done: destructor for return value
|
||||
*/
|
||||
|
||||
static const char *
|
||||
v9fs_vfs_follow_link_dotl(struct dentry *dentry, void **cookie)
|
||||
v9fs_vfs_get_link_dotl(struct dentry *dentry,
|
||||
struct inode *inode,
|
||||
struct delayed_call *done)
|
||||
{
|
||||
struct p9_fid *fid = v9fs_fid_lookup(dentry);
|
||||
struct p9_fid *fid;
|
||||
char *target;
|
||||
int retval;
|
||||
|
||||
if (!dentry)
|
||||
return ERR_PTR(-ECHILD);
|
||||
|
||||
p9_debug(P9_DEBUG_VFS, "%pd\n", dentry);
|
||||
|
||||
fid = v9fs_fid_lookup(dentry);
|
||||
if (IS_ERR(fid))
|
||||
return ERR_CAST(fid);
|
||||
retval = p9_client_readlink(fid, &target);
|
||||
if (retval)
|
||||
return ERR_PTR(retval);
|
||||
return *cookie = target;
|
||||
set_delayed_call(done, kfree_link, target);
|
||||
return target;
|
||||
}
|
||||
|
||||
int v9fs_refresh_inode_dotl(struct p9_fid *fid, struct inode *inode)
|
||||
@@ -984,8 +992,7 @@ const struct inode_operations v9fs_file_inode_operations_dotl = {
|
||||
|
||||
const struct inode_operations v9fs_symlink_inode_operations_dotl = {
|
||||
.readlink = generic_readlink,
|
||||
.follow_link = v9fs_vfs_follow_link_dotl,
|
||||
.put_link = kfree_put_link,
|
||||
.get_link = v9fs_vfs_get_link_dotl,
|
||||
.getattr = v9fs_vfs_getattr_dotl,
|
||||
.setattr = v9fs_vfs_setattr_dotl,
|
||||
.setxattr = generic_setxattr,
|
||||
|
||||
@@ -140,6 +140,7 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino)
|
||||
break;
|
||||
case ST_SOFTLINK:
|
||||
inode->i_mode |= S_IFLNK;
|
||||
inode_nohighmem(inode);
|
||||
inode->i_op = &affs_symlink_inode_operations;
|
||||
inode->i_data.a_ops = &affs_symlink_aops;
|
||||
break;
|
||||
|
||||
@@ -344,6 +344,7 @@ affs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
|
||||
return -ENOSPC;
|
||||
|
||||
inode->i_op = &affs_symlink_inode_operations;
|
||||
inode_nohighmem(inode);
|
||||
inode->i_data.a_ops = &affs_symlink_aops;
|
||||
inode->i_mode = S_IFLNK | 0777;
|
||||
mode_to_prot(inode);
|
||||
|
||||
+3
-6
@@ -14,13 +14,13 @@ static int affs_symlink_readpage(struct file *file, struct page *page)
|
||||
{
|
||||
struct buffer_head *bh;
|
||||
struct inode *inode = page->mapping->host;
|
||||
char *link = kmap(page);
|
||||
char *link = page_address(page);
|
||||
struct slink_front *lf;
|
||||
int i, j;
|
||||
char c;
|
||||
char lc;
|
||||
|
||||
pr_debug("follow_link(ino=%lu)\n", inode->i_ino);
|
||||
pr_debug("get_link(ino=%lu)\n", inode->i_ino);
|
||||
|
||||
bh = affs_bread(inode->i_sb, inode->i_ino);
|
||||
if (!bh)
|
||||
@@ -57,12 +57,10 @@ static int affs_symlink_readpage(struct file *file, struct page *page)
|
||||
link[i] = '\0';
|
||||
affs_brelse(bh);
|
||||
SetPageUptodate(page);
|
||||
kunmap(page);
|
||||
unlock_page(page);
|
||||
return 0;
|
||||
fail:
|
||||
SetPageError(page);
|
||||
kunmap(page);
|
||||
unlock_page(page);
|
||||
return -EIO;
|
||||
}
|
||||
@@ -73,7 +71,6 @@ const struct address_space_operations affs_symlink_aops = {
|
||||
|
||||
const struct inode_operations affs_symlink_inode_operations = {
|
||||
.readlink = generic_readlink,
|
||||
.follow_link = page_follow_link_light,
|
||||
.put_link = page_put_link,
|
||||
.get_link = page_get_link,
|
||||
.setattr = affs_notify_change,
|
||||
};
|
||||
|
||||
@@ -56,6 +56,7 @@ static int afs_inode_map_status(struct afs_vnode *vnode, struct key *key)
|
||||
case AFS_FTYPE_SYMLINK:
|
||||
inode->i_mode = S_IFLNK | vnode->status.mode;
|
||||
inode->i_op = &page_symlink_inode_operations;
|
||||
inode_nohighmem(inode);
|
||||
break;
|
||||
default:
|
||||
printk("kAFS: AFS vnode with undefined type\n");
|
||||
|
||||
+10
-4
@@ -12,10 +12,16 @@
|
||||
|
||||
#include "autofs_i.h"
|
||||
|
||||
static const char *autofs4_follow_link(struct dentry *dentry, void **cookie)
|
||||
static const char *autofs4_get_link(struct dentry *dentry,
|
||||
struct inode *inode,
|
||||
struct delayed_call *done)
|
||||
{
|
||||
struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
|
||||
struct autofs_info *ino = autofs4_dentry_ino(dentry);
|
||||
struct autofs_sb_info *sbi;
|
||||
struct autofs_info *ino;
|
||||
if (!dentry)
|
||||
return ERR_PTR(-ECHILD);
|
||||
sbi = autofs4_sbi(dentry->d_sb);
|
||||
ino = autofs4_dentry_ino(dentry);
|
||||
if (ino && !autofs4_oz_mode(sbi))
|
||||
ino->last_used = jiffies;
|
||||
return d_inode(dentry)->i_private;
|
||||
@@ -23,5 +29,5 @@ static const char *autofs4_follow_link(struct dentry *dentry, void **cookie)
|
||||
|
||||
const struct inode_operations autofs4_symlink_inode_operations = {
|
||||
.readlink = generic_readlink,
|
||||
.follow_link = autofs4_follow_link
|
||||
.get_link = autofs4_get_link
|
||||
};
|
||||
|
||||
+21
-19
@@ -42,7 +42,7 @@ static struct inode *befs_iget(struct super_block *, unsigned long);
|
||||
static struct inode *befs_alloc_inode(struct super_block *sb);
|
||||
static void befs_destroy_inode(struct inode *inode);
|
||||
static void befs_destroy_inodecache(void);
|
||||
static const char *befs_follow_link(struct dentry *, void **);
|
||||
static int befs_symlink_readpage(struct file *, struct page *);
|
||||
static int befs_utf2nls(struct super_block *sb, const char *in, int in_len,
|
||||
char **out, int *out_len);
|
||||
static int befs_nls2utf(struct super_block *sb, const char *in, int in_len,
|
||||
@@ -79,10 +79,8 @@ static const struct address_space_operations befs_aops = {
|
||||
.bmap = befs_bmap,
|
||||
};
|
||||
|
||||
static const struct inode_operations befs_symlink_inode_operations = {
|
||||
.readlink = generic_readlink,
|
||||
.follow_link = befs_follow_link,
|
||||
.put_link = kfree_put_link,
|
||||
static const struct address_space_operations befs_symlink_aops = {
|
||||
.readpage = befs_symlink_readpage,
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -398,7 +396,9 @@ static struct inode *befs_iget(struct super_block *sb, unsigned long ino)
|
||||
inode->i_fop = &befs_dir_operations;
|
||||
} else if (S_ISLNK(inode->i_mode)) {
|
||||
if (befs_ino->i_flags & BEFS_LONG_SYMLINK) {
|
||||
inode->i_op = &befs_symlink_inode_operations;
|
||||
inode->i_op = &page_symlink_inode_operations;
|
||||
inode_nohighmem(inode);
|
||||
inode->i_mapping->a_ops = &befs_symlink_aops;
|
||||
} else {
|
||||
inode->i_link = befs_ino->i_data.symlink;
|
||||
inode->i_op = &simple_symlink_inode_operations;
|
||||
@@ -463,31 +463,33 @@ befs_destroy_inodecache(void)
|
||||
* The data stream become link name. Unless the LONG_SYMLINK
|
||||
* flag is set.
|
||||
*/
|
||||
static const char *
|
||||
befs_follow_link(struct dentry *dentry, void **cookie)
|
||||
static int befs_symlink_readpage(struct file *unused, struct page *page)
|
||||
{
|
||||
struct super_block *sb = dentry->d_sb;
|
||||
struct befs_inode_info *befs_ino = BEFS_I(d_inode(dentry));
|
||||
struct inode *inode = page->mapping->host;
|
||||
struct super_block *sb = inode->i_sb;
|
||||
struct befs_inode_info *befs_ino = BEFS_I(inode);
|
||||
befs_data_stream *data = &befs_ino->i_data.ds;
|
||||
befs_off_t len = data->size;
|
||||
char *link;
|
||||
char *link = page_address(page);
|
||||
|
||||
if (len == 0) {
|
||||
if (len == 0 || len > PAGE_SIZE) {
|
||||
befs_error(sb, "Long symlink with illegal length");
|
||||
return ERR_PTR(-EIO);
|
||||
goto fail;
|
||||
}
|
||||
befs_debug(sb, "Follow long symlink");
|
||||
|
||||
link = kmalloc(len, GFP_NOFS);
|
||||
if (!link)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
if (befs_read_lsymlink(sb, data, link, len) != len) {
|
||||
kfree(link);
|
||||
befs_error(sb, "Failed to read entire long symlink");
|
||||
return ERR_PTR(-EIO);
|
||||
goto fail;
|
||||
}
|
||||
link[len - 1] = '\0';
|
||||
return *cookie = link;
|
||||
SetPageUptodate(page);
|
||||
unlock_page(page);
|
||||
return 0;
|
||||
fail:
|
||||
SetPageError(page);
|
||||
unlock_page(page);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+3
-2
@@ -3774,6 +3774,7 @@ cache_acl:
|
||||
break;
|
||||
case S_IFLNK:
|
||||
inode->i_op = &btrfs_symlink_inode_operations;
|
||||
inode_nohighmem(inode);
|
||||
inode->i_mapping->a_ops = &btrfs_symlink_aops;
|
||||
break;
|
||||
default:
|
||||
@@ -9705,6 +9706,7 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
|
||||
btrfs_free_path(path);
|
||||
|
||||
inode->i_op = &btrfs_symlink_inode_operations;
|
||||
inode_nohighmem(inode);
|
||||
inode->i_mapping->a_ops = &btrfs_symlink_aops;
|
||||
inode_set_bytes(inode, name_len);
|
||||
btrfs_i_size_write(inode, name_len);
|
||||
@@ -10094,8 +10096,7 @@ static const struct inode_operations btrfs_special_inode_operations = {
|
||||
};
|
||||
static const struct inode_operations btrfs_symlink_inode_operations = {
|
||||
.readlink = generic_readlink,
|
||||
.follow_link = page_follow_link_light,
|
||||
.put_link = page_put_link,
|
||||
.get_link = page_get_link,
|
||||
.getattr = btrfs_getattr,
|
||||
.setattr = btrfs_setattr,
|
||||
.permission = btrfs_permission,
|
||||
|
||||
+1
-1
@@ -1756,7 +1756,7 @@ retry:
|
||||
*/
|
||||
static const struct inode_operations ceph_symlink_iops = {
|
||||
.readlink = generic_readlink,
|
||||
.follow_link = simple_follow_link,
|
||||
.get_link = simple_get_link,
|
||||
.setattr = ceph_setattr,
|
||||
.getattr = ceph_getattr,
|
||||
.setxattr = ceph_setxattr,
|
||||
|
||||
+1
-2
@@ -900,8 +900,7 @@ const struct inode_operations cifs_file_inode_ops = {
|
||||
|
||||
const struct inode_operations cifs_symlink_inode_ops = {
|
||||
.readlink = generic_readlink,
|
||||
.follow_link = cifs_follow_link,
|
||||
.put_link = kfree_put_link,
|
||||
.get_link = cifs_get_link,
|
||||
.permission = cifs_permission,
|
||||
/* BB add the following two eventually */
|
||||
/* revalidate: cifs_revalidate,
|
||||
|
||||
+2
-3
@@ -120,9 +120,8 @@ extern struct vfsmount *cifs_dfs_d_automount(struct path *path);
|
||||
#endif
|
||||
|
||||
/* Functions related to symlinks */
|
||||
extern const char *cifs_follow_link(struct dentry *direntry, void **cookie);
|
||||
extern int cifs_readlink(struct dentry *direntry, char __user *buffer,
|
||||
int buflen);
|
||||
extern const char *cifs_get_link(struct dentry *, struct inode *,
|
||||
struct delayed_call *);
|
||||
extern int cifs_symlink(struct inode *inode, struct dentry *direntry,
|
||||
const char *symname);
|
||||
extern int cifs_removexattr(struct dentry *, const char *);
|
||||
|
||||
+7
-3
@@ -627,9 +627,9 @@ cifs_hl_exit:
|
||||
}
|
||||
|
||||
const char *
|
||||
cifs_follow_link(struct dentry *direntry, void **cookie)
|
||||
cifs_get_link(struct dentry *direntry, struct inode *inode,
|
||||
struct delayed_call *done)
|
||||
{
|
||||
struct inode *inode = d_inode(direntry);
|
||||
int rc = -ENOMEM;
|
||||
unsigned int xid;
|
||||
char *full_path = NULL;
|
||||
@@ -639,6 +639,9 @@ cifs_follow_link(struct dentry *direntry, void **cookie)
|
||||
struct cifs_tcon *tcon;
|
||||
struct TCP_Server_Info *server;
|
||||
|
||||
if (!direntry)
|
||||
return ERR_PTR(-ECHILD);
|
||||
|
||||
xid = get_xid();
|
||||
|
||||
tlink = cifs_sb_tlink(cifs_sb);
|
||||
@@ -678,7 +681,8 @@ cifs_follow_link(struct dentry *direntry, void **cookie)
|
||||
kfree(target_path);
|
||||
return ERR_PTR(rc);
|
||||
}
|
||||
return *cookie = target_path;
|
||||
set_delayed_call(done, kfree_link, target_path);
|
||||
return target_path;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
+3
-2
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <linux/coda.h>
|
||||
#include <linux/coda_psdev.h>
|
||||
#include <linux/pagemap.h>
|
||||
#include "coda_linux.h"
|
||||
|
||||
static inline int coda_fideq(struct CodaFid *fid1, struct CodaFid *fid2)
|
||||
@@ -17,8 +18,7 @@ static inline int coda_fideq(struct CodaFid *fid1, struct CodaFid *fid2)
|
||||
|
||||
static const struct inode_operations coda_symlink_inode_operations = {
|
||||
.readlink = generic_readlink,
|
||||
.follow_link = page_follow_link_light,
|
||||
.put_link = page_put_link,
|
||||
.get_link = page_get_link,
|
||||
.setattr = coda_setattr,
|
||||
};
|
||||
|
||||
@@ -35,6 +35,7 @@ static void coda_fill_inode(struct inode *inode, struct coda_vattr *attr)
|
||||
inode->i_fop = &coda_dir_operations;
|
||||
} else if (S_ISLNK(inode->i_mode)) {
|
||||
inode->i_op = &coda_symlink_inode_operations;
|
||||
inode_nohighmem(inode);
|
||||
inode->i_data.a_ops = &coda_symlink_aops;
|
||||
inode->i_mapping = &inode->i_data;
|
||||
} else
|
||||
|
||||
+1
-3
@@ -26,7 +26,7 @@ static int coda_symlink_filler(struct file *file, struct page *page)
|
||||
int error;
|
||||
struct coda_inode_info *cii;
|
||||
unsigned int len = PAGE_SIZE;
|
||||
char *p = kmap(page);
|
||||
char *p = page_address(page);
|
||||
|
||||
cii = ITOC(inode);
|
||||
|
||||
@@ -34,13 +34,11 @@ static int coda_symlink_filler(struct file *file, struct page *page)
|
||||
if (error)
|
||||
goto fail;
|
||||
SetPageUptodate(page);
|
||||
kunmap(page);
|
||||
unlock_page(page);
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
SetPageError(page);
|
||||
kunmap(page);
|
||||
unlock_page(page);
|
||||
return error;
|
||||
}
|
||||
|
||||
+14
-8
@@ -279,27 +279,33 @@ static int configfs_getlink(struct dentry *dentry, char * path)
|
||||
|
||||
}
|
||||
|
||||
static const char *configfs_follow_link(struct dentry *dentry, void **cookie)
|
||||
static const char *configfs_get_link(struct dentry *dentry,
|
||||
struct inode *inode,
|
||||
struct delayed_call *done)
|
||||
{
|
||||
unsigned long page = get_zeroed_page(GFP_KERNEL);
|
||||
char *body;
|
||||
int error;
|
||||
|
||||
if (!page)
|
||||
if (!dentry)
|
||||
return ERR_PTR(-ECHILD);
|
||||
|
||||
body = kzalloc(PAGE_SIZE, GFP_KERNEL);
|
||||
if (!body)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
error = configfs_getlink(dentry, (char *)page);
|
||||
error = configfs_getlink(dentry, body);
|
||||
if (!error) {
|
||||
return *cookie = (void *)page;
|
||||
set_delayed_call(done, kfree_link, body);
|
||||
return body;
|
||||
}
|
||||
|
||||
free_page(page);
|
||||
kfree(body);
|
||||
return ERR_PTR(error);
|
||||
}
|
||||
|
||||
const struct inode_operations configfs_symlink_inode_operations = {
|
||||
.follow_link = configfs_follow_link,
|
||||
.get_link = configfs_get_link,
|
||||
.readlink = generic_readlink,
|
||||
.put_link = free_page_put_link,
|
||||
.setattr = configfs_setattr,
|
||||
};
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user