mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-01 10:43:43 +00:00
VFS: assorted weird filesystems: d_inode() annotations
Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
2b0143b5c9
commit
75c3cfa855
@ -2159,7 +2159,7 @@ static const struct file_operations pfm_file_ops = {
|
|||||||
static char *pfmfs_dname(struct dentry *dentry, char *buffer, int buflen)
|
static char *pfmfs_dname(struct dentry *dentry, char *buffer, int buflen)
|
||||||
{
|
{
|
||||||
return dynamic_dname(dentry, buffer, buflen, "pfm:[%lu]",
|
return dynamic_dname(dentry, buffer, buflen, "pfm:[%lu]",
|
||||||
dentry->d_inode->i_ino);
|
d_inode(dentry)->i_ino);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct dentry_operations pfmfs_dentry_operations = {
|
static const struct dentry_operations pfmfs_dentry_operations = {
|
||||||
|
@ -111,7 +111,7 @@ spufs_new_inode(struct super_block *sb, umode_t mode)
|
|||||||
static int
|
static int
|
||||||
spufs_setattr(struct dentry *dentry, struct iattr *attr)
|
spufs_setattr(struct dentry *dentry, struct iattr *attr)
|
||||||
{
|
{
|
||||||
struct inode *inode = dentry->d_inode;
|
struct inode *inode = d_inode(dentry);
|
||||||
|
|
||||||
if ((attr->ia_valid & ATTR_SIZE) &&
|
if ((attr->ia_valid & ATTR_SIZE) &&
|
||||||
(attr->ia_size != inode->i_size))
|
(attr->ia_size != inode->i_size))
|
||||||
@ -163,14 +163,14 @@ static void spufs_prune_dir(struct dentry *dir)
|
|||||||
{
|
{
|
||||||
struct dentry *dentry, *tmp;
|
struct dentry *dentry, *tmp;
|
||||||
|
|
||||||
mutex_lock(&dir->d_inode->i_mutex);
|
mutex_lock(&d_inode(dir)->i_mutex);
|
||||||
list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_child) {
|
list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_child) {
|
||||||
spin_lock(&dentry->d_lock);
|
spin_lock(&dentry->d_lock);
|
||||||
if (!(d_unhashed(dentry)) && dentry->d_inode) {
|
if (!(d_unhashed(dentry)) && d_really_is_positive(dentry)) {
|
||||||
dget_dlock(dentry);
|
dget_dlock(dentry);
|
||||||
__d_drop(dentry);
|
__d_drop(dentry);
|
||||||
spin_unlock(&dentry->d_lock);
|
spin_unlock(&dentry->d_lock);
|
||||||
simple_unlink(dir->d_inode, dentry);
|
simple_unlink(d_inode(dir), dentry);
|
||||||
/* XXX: what was dcache_lock protecting here? Other
|
/* XXX: what was dcache_lock protecting here? Other
|
||||||
* filesystems (IB, configfs) release dcache_lock
|
* filesystems (IB, configfs) release dcache_lock
|
||||||
* before unlink */
|
* before unlink */
|
||||||
@ -180,7 +180,7 @@ static void spufs_prune_dir(struct dentry *dir)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
shrink_dcache_parent(dir);
|
shrink_dcache_parent(dir);
|
||||||
mutex_unlock(&dir->d_inode->i_mutex);
|
mutex_unlock(&d_inode(dir)->i_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Caller must hold parent->i_mutex */
|
/* Caller must hold parent->i_mutex */
|
||||||
@ -192,7 +192,7 @@ static int spufs_rmdir(struct inode *parent, struct dentry *dir)
|
|||||||
d_drop(dir);
|
d_drop(dir);
|
||||||
res = simple_rmdir(parent, dir);
|
res = simple_rmdir(parent, dir);
|
||||||
/* We have to give up the mm_struct */
|
/* We have to give up the mm_struct */
|
||||||
spu_forget(SPUFS_I(dir->d_inode)->i_ctx);
|
spu_forget(SPUFS_I(d_inode(dir))->i_ctx);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,8 +222,8 @@ static int spufs_dir_close(struct inode *inode, struct file *file)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
dir = file->f_path.dentry;
|
dir = file->f_path.dentry;
|
||||||
parent = dir->d_parent->d_inode;
|
parent = d_inode(dir->d_parent);
|
||||||
ctx = SPUFS_I(dir->d_inode)->i_ctx;
|
ctx = SPUFS_I(d_inode(dir))->i_ctx;
|
||||||
|
|
||||||
mutex_lock_nested(&parent->i_mutex, I_MUTEX_PARENT);
|
mutex_lock_nested(&parent->i_mutex, I_MUTEX_PARENT);
|
||||||
ret = spufs_rmdir(parent, dir);
|
ret = spufs_rmdir(parent, dir);
|
||||||
@ -460,7 +460,7 @@ spufs_create_context(struct inode *inode, struct dentry *dentry,
|
|||||||
goto out_aff_unlock;
|
goto out_aff_unlock;
|
||||||
|
|
||||||
if (affinity) {
|
if (affinity) {
|
||||||
spufs_set_affinity(flags, SPUFS_I(dentry->d_inode)->i_ctx,
|
spufs_set_affinity(flags, SPUFS_I(d_inode(dentry))->i_ctx,
|
||||||
neighbor);
|
neighbor);
|
||||||
if (neighbor)
|
if (neighbor)
|
||||||
put_spu_context(neighbor);
|
put_spu_context(neighbor);
|
||||||
@ -504,7 +504,7 @@ spufs_mkgang(struct inode *dir, struct dentry *dentry, umode_t mode)
|
|||||||
|
|
||||||
d_instantiate(dentry, inode);
|
d_instantiate(dentry, inode);
|
||||||
inc_nlink(dir);
|
inc_nlink(dir);
|
||||||
inc_nlink(dentry->d_inode);
|
inc_nlink(d_inode(dentry));
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
out_iput:
|
out_iput:
|
||||||
@ -561,7 +561,7 @@ static struct file_system_type spufs_type;
|
|||||||
long spufs_create(struct path *path, struct dentry *dentry,
|
long spufs_create(struct path *path, struct dentry *dentry,
|
||||||
unsigned int flags, umode_t mode, struct file *filp)
|
unsigned int flags, umode_t mode, struct file *filp)
|
||||||
{
|
{
|
||||||
struct inode *dir = path->dentry->d_inode;
|
struct inode *dir = d_inode(path->dentry);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* check if we are on spufs */
|
/* check if we are on spufs */
|
||||||
|
@ -48,7 +48,7 @@ static struct dentry *hypfs_last_dentry;
|
|||||||
static void hypfs_update_update(struct super_block *sb)
|
static void hypfs_update_update(struct super_block *sb)
|
||||||
{
|
{
|
||||||
struct hypfs_sb_info *sb_info = sb->s_fs_info;
|
struct hypfs_sb_info *sb_info = sb->s_fs_info;
|
||||||
struct inode *inode = sb_info->update_file->d_inode;
|
struct inode *inode = d_inode(sb_info->update_file);
|
||||||
|
|
||||||
sb_info->last_update = get_seconds();
|
sb_info->last_update = get_seconds();
|
||||||
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
|
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
|
||||||
@ -64,7 +64,7 @@ static void hypfs_add_dentry(struct dentry *dentry)
|
|||||||
|
|
||||||
static inline int hypfs_positive(struct dentry *dentry)
|
static inline int hypfs_positive(struct dentry *dentry)
|
||||||
{
|
{
|
||||||
return dentry->d_inode && !d_unhashed(dentry);
|
return d_really_is_positive(dentry) && !d_unhashed(dentry);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hypfs_remove(struct dentry *dentry)
|
static void hypfs_remove(struct dentry *dentry)
|
||||||
@ -72,16 +72,16 @@ static void hypfs_remove(struct dentry *dentry)
|
|||||||
struct dentry *parent;
|
struct dentry *parent;
|
||||||
|
|
||||||
parent = dentry->d_parent;
|
parent = dentry->d_parent;
|
||||||
mutex_lock(&parent->d_inode->i_mutex);
|
mutex_lock(&d_inode(parent)->i_mutex);
|
||||||
if (hypfs_positive(dentry)) {
|
if (hypfs_positive(dentry)) {
|
||||||
if (d_is_dir(dentry))
|
if (d_is_dir(dentry))
|
||||||
simple_rmdir(parent->d_inode, dentry);
|
simple_rmdir(d_inode(parent), dentry);
|
||||||
else
|
else
|
||||||
simple_unlink(parent->d_inode, dentry);
|
simple_unlink(d_inode(parent), dentry);
|
||||||
}
|
}
|
||||||
d_delete(dentry);
|
d_delete(dentry);
|
||||||
dput(dentry);
|
dput(dentry);
|
||||||
mutex_unlock(&parent->d_inode->i_mutex);
|
mutex_unlock(&d_inode(parent)->i_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hypfs_delete_tree(struct dentry *root)
|
static void hypfs_delete_tree(struct dentry *root)
|
||||||
@ -336,7 +336,7 @@ static struct dentry *hypfs_create_file(struct dentry *parent, const char *name,
|
|||||||
struct dentry *dentry;
|
struct dentry *dentry;
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
|
|
||||||
mutex_lock(&parent->d_inode->i_mutex);
|
mutex_lock(&d_inode(parent)->i_mutex);
|
||||||
dentry = lookup_one_len(name, parent, strlen(name));
|
dentry = lookup_one_len(name, parent, strlen(name));
|
||||||
if (IS_ERR(dentry)) {
|
if (IS_ERR(dentry)) {
|
||||||
dentry = ERR_PTR(-ENOMEM);
|
dentry = ERR_PTR(-ENOMEM);
|
||||||
@ -357,14 +357,14 @@ static struct dentry *hypfs_create_file(struct dentry *parent, const char *name,
|
|||||||
} else if (S_ISDIR(mode)) {
|
} else if (S_ISDIR(mode)) {
|
||||||
inode->i_op = &simple_dir_inode_operations;
|
inode->i_op = &simple_dir_inode_operations;
|
||||||
inode->i_fop = &simple_dir_operations;
|
inode->i_fop = &simple_dir_operations;
|
||||||
inc_nlink(parent->d_inode);
|
inc_nlink(d_inode(parent));
|
||||||
} else
|
} else
|
||||||
BUG();
|
BUG();
|
||||||
inode->i_private = data;
|
inode->i_private = data;
|
||||||
d_instantiate(dentry, inode);
|
d_instantiate(dentry, inode);
|
||||||
dget(dentry);
|
dget(dentry);
|
||||||
fail:
|
fail:
|
||||||
mutex_unlock(&parent->d_inode->i_mutex);
|
mutex_unlock(&d_inode(parent)->i_mutex);
|
||||||
return dentry;
|
return dentry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,10 +157,10 @@ static int dev_mkdir(const char *name, umode_t mode)
|
|||||||
if (IS_ERR(dentry))
|
if (IS_ERR(dentry))
|
||||||
return PTR_ERR(dentry);
|
return PTR_ERR(dentry);
|
||||||
|
|
||||||
err = vfs_mkdir(path.dentry->d_inode, dentry, mode);
|
err = vfs_mkdir(d_inode(path.dentry), dentry, mode);
|
||||||
if (!err)
|
if (!err)
|
||||||
/* mark as kernel-created inode */
|
/* mark as kernel-created inode */
|
||||||
dentry->d_inode->i_private = &thread;
|
d_inode(dentry)->i_private = &thread;
|
||||||
done_path_create(&path, dentry);
|
done_path_create(&path, dentry);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -207,7 +207,7 @@ static int handle_create(const char *nodename, umode_t mode, kuid_t uid,
|
|||||||
if (IS_ERR(dentry))
|
if (IS_ERR(dentry))
|
||||||
return PTR_ERR(dentry);
|
return PTR_ERR(dentry);
|
||||||
|
|
||||||
err = vfs_mknod(path.dentry->d_inode, dentry, mode, dev->devt);
|
err = vfs_mknod(d_inode(path.dentry), dentry, mode, dev->devt);
|
||||||
if (!err) {
|
if (!err) {
|
||||||
struct iattr newattrs;
|
struct iattr newattrs;
|
||||||
|
|
||||||
@ -215,12 +215,12 @@ static int handle_create(const char *nodename, umode_t mode, kuid_t uid,
|
|||||||
newattrs.ia_uid = uid;
|
newattrs.ia_uid = uid;
|
||||||
newattrs.ia_gid = gid;
|
newattrs.ia_gid = gid;
|
||||||
newattrs.ia_valid = ATTR_MODE|ATTR_UID|ATTR_GID;
|
newattrs.ia_valid = ATTR_MODE|ATTR_UID|ATTR_GID;
|
||||||
mutex_lock(&dentry->d_inode->i_mutex);
|
mutex_lock(&d_inode(dentry)->i_mutex);
|
||||||
notify_change(dentry, &newattrs, NULL);
|
notify_change(dentry, &newattrs, NULL);
|
||||||
mutex_unlock(&dentry->d_inode->i_mutex);
|
mutex_unlock(&d_inode(dentry)->i_mutex);
|
||||||
|
|
||||||
/* mark as kernel-created inode */
|
/* mark as kernel-created inode */
|
||||||
dentry->d_inode->i_private = &thread;
|
d_inode(dentry)->i_private = &thread;
|
||||||
}
|
}
|
||||||
done_path_create(&path, dentry);
|
done_path_create(&path, dentry);
|
||||||
return err;
|
return err;
|
||||||
@ -235,16 +235,16 @@ static int dev_rmdir(const char *name)
|
|||||||
dentry = kern_path_locked(name, &parent);
|
dentry = kern_path_locked(name, &parent);
|
||||||
if (IS_ERR(dentry))
|
if (IS_ERR(dentry))
|
||||||
return PTR_ERR(dentry);
|
return PTR_ERR(dentry);
|
||||||
if (dentry->d_inode) {
|
if (d_really_is_positive(dentry)) {
|
||||||
if (dentry->d_inode->i_private == &thread)
|
if (d_inode(dentry)->i_private == &thread)
|
||||||
err = vfs_rmdir(parent.dentry->d_inode, dentry);
|
err = vfs_rmdir(d_inode(parent.dentry), dentry);
|
||||||
else
|
else
|
||||||
err = -EPERM;
|
err = -EPERM;
|
||||||
} else {
|
} else {
|
||||||
err = -ENOENT;
|
err = -ENOENT;
|
||||||
}
|
}
|
||||||
dput(dentry);
|
dput(dentry);
|
||||||
mutex_unlock(&parent.dentry->d_inode->i_mutex);
|
mutex_unlock(&d_inode(parent.dentry)->i_mutex);
|
||||||
path_put(&parent);
|
path_put(&parent);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -306,11 +306,11 @@ static int handle_remove(const char *nodename, struct device *dev)
|
|||||||
if (IS_ERR(dentry))
|
if (IS_ERR(dentry))
|
||||||
return PTR_ERR(dentry);
|
return PTR_ERR(dentry);
|
||||||
|
|
||||||
if (dentry->d_inode) {
|
if (d_really_is_positive(dentry)) {
|
||||||
struct kstat stat;
|
struct kstat stat;
|
||||||
struct path p = {.mnt = parent.mnt, .dentry = dentry};
|
struct path p = {.mnt = parent.mnt, .dentry = dentry};
|
||||||
err = vfs_getattr(&p, &stat);
|
err = vfs_getattr(&p, &stat);
|
||||||
if (!err && dev_mynode(dev, dentry->d_inode, &stat)) {
|
if (!err && dev_mynode(dev, d_inode(dentry), &stat)) {
|
||||||
struct iattr newattrs;
|
struct iattr newattrs;
|
||||||
/*
|
/*
|
||||||
* before unlinking this node, reset permissions
|
* before unlinking this node, reset permissions
|
||||||
@ -321,10 +321,10 @@ static int handle_remove(const char *nodename, struct device *dev)
|
|||||||
newattrs.ia_mode = stat.mode & ~0777;
|
newattrs.ia_mode = stat.mode & ~0777;
|
||||||
newattrs.ia_valid =
|
newattrs.ia_valid =
|
||||||
ATTR_UID|ATTR_GID|ATTR_MODE;
|
ATTR_UID|ATTR_GID|ATTR_MODE;
|
||||||
mutex_lock(&dentry->d_inode->i_mutex);
|
mutex_lock(&d_inode(dentry)->i_mutex);
|
||||||
notify_change(dentry, &newattrs, NULL);
|
notify_change(dentry, &newattrs, NULL);
|
||||||
mutex_unlock(&dentry->d_inode->i_mutex);
|
mutex_unlock(&d_inode(dentry)->i_mutex);
|
||||||
err = vfs_unlink(parent.dentry->d_inode, dentry, NULL);
|
err = vfs_unlink(d_inode(parent.dentry), dentry, NULL);
|
||||||
if (!err || err == -ENOENT)
|
if (!err || err == -ENOENT)
|
||||||
deleted = 1;
|
deleted = 1;
|
||||||
}
|
}
|
||||||
@ -332,7 +332,7 @@ static int handle_remove(const char *nodename, struct device *dev)
|
|||||||
err = -ENOENT;
|
err = -ENOENT;
|
||||||
}
|
}
|
||||||
dput(dentry);
|
dput(dentry);
|
||||||
mutex_unlock(&parent.dentry->d_inode->i_mutex);
|
mutex_unlock(&d_inode(parent.dentry)->i_mutex);
|
||||||
|
|
||||||
path_put(&parent);
|
path_put(&parent);
|
||||||
if (deleted && strchr(nodename, '/'))
|
if (deleted && strchr(nodename, '/'))
|
||||||
|
@ -424,7 +424,7 @@ static int in_flight_summary_show(struct seq_file *m, void *pos)
|
|||||||
* So we have our own inline version of it above. :-( */
|
* So we have our own inline version of it above. :-( */
|
||||||
static inline int debugfs_positive(struct dentry *dentry)
|
static inline int debugfs_positive(struct dentry *dentry)
|
||||||
{
|
{
|
||||||
return dentry->d_inode && !d_unhashed(dentry);
|
return d_really_is_positive(dentry) && !d_unhashed(dentry);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* make sure at *open* time that the respective object won't go away. */
|
/* make sure at *open* time that the respective object won't go away. */
|
||||||
@ -439,15 +439,15 @@ static int drbd_single_open(struct file *file, int (*show)(struct seq_file *, vo
|
|||||||
* or has debugfs_remove() already been called? */
|
* or has debugfs_remove() already been called? */
|
||||||
parent = file->f_path.dentry->d_parent;
|
parent = file->f_path.dentry->d_parent;
|
||||||
/* not sure if this can happen: */
|
/* not sure if this can happen: */
|
||||||
if (!parent || !parent->d_inode)
|
if (!parent || d_really_is_negative(parent))
|
||||||
goto out;
|
goto out;
|
||||||
/* serialize with d_delete() */
|
/* serialize with d_delete() */
|
||||||
mutex_lock(&parent->d_inode->i_mutex);
|
mutex_lock(&d_inode(parent)->i_mutex);
|
||||||
/* Make sure the object is still alive */
|
/* Make sure the object is still alive */
|
||||||
if (debugfs_positive(file->f_path.dentry)
|
if (debugfs_positive(file->f_path.dentry)
|
||||||
&& kref_get_unless_zero(kref))
|
&& kref_get_unless_zero(kref))
|
||||||
ret = 0;
|
ret = 0;
|
||||||
mutex_unlock(&parent->d_inode->i_mutex);
|
mutex_unlock(&d_inode(parent)->i_mutex);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
ret = single_open(file, show, data);
|
ret = single_open(file, show, data);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -82,14 +82,14 @@ static int create_file(const char *name, umode_t mode,
|
|||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
mutex_lock(&parent->d_inode->i_mutex);
|
mutex_lock(&d_inode(parent)->i_mutex);
|
||||||
*dentry = lookup_one_len(name, parent, strlen(name));
|
*dentry = lookup_one_len(name, parent, strlen(name));
|
||||||
if (!IS_ERR(*dentry))
|
if (!IS_ERR(*dentry))
|
||||||
error = ipathfs_mknod(parent->d_inode, *dentry,
|
error = ipathfs_mknod(d_inode(parent), *dentry,
|
||||||
mode, fops, data);
|
mode, fops, data);
|
||||||
else
|
else
|
||||||
error = PTR_ERR(*dentry);
|
error = PTR_ERR(*dentry);
|
||||||
mutex_unlock(&parent->d_inode->i_mutex);
|
mutex_unlock(&d_inode(parent)->i_mutex);
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
@ -277,11 +277,11 @@ static int remove_file(struct dentry *parent, char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
spin_lock(&tmp->d_lock);
|
spin_lock(&tmp->d_lock);
|
||||||
if (!d_unhashed(tmp) && tmp->d_inode) {
|
if (!d_unhashed(tmp) && d_really_is_positive(tmp)) {
|
||||||
dget_dlock(tmp);
|
dget_dlock(tmp);
|
||||||
__d_drop(tmp);
|
__d_drop(tmp);
|
||||||
spin_unlock(&tmp->d_lock);
|
spin_unlock(&tmp->d_lock);
|
||||||
simple_unlink(parent->d_inode, tmp);
|
simple_unlink(d_inode(parent), tmp);
|
||||||
} else
|
} else
|
||||||
spin_unlock(&tmp->d_lock);
|
spin_unlock(&tmp->d_lock);
|
||||||
|
|
||||||
@ -302,7 +302,7 @@ static int remove_device_files(struct super_block *sb,
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
root = dget(sb->s_root);
|
root = dget(sb->s_root);
|
||||||
mutex_lock(&root->d_inode->i_mutex);
|
mutex_lock(&d_inode(root)->i_mutex);
|
||||||
snprintf(unit, sizeof unit, "%02d", dd->ipath_unit);
|
snprintf(unit, sizeof unit, "%02d", dd->ipath_unit);
|
||||||
dir = lookup_one_len(unit, root, strlen(unit));
|
dir = lookup_one_len(unit, root, strlen(unit));
|
||||||
|
|
||||||
@ -315,10 +315,10 @@ static int remove_device_files(struct super_block *sb,
|
|||||||
remove_file(dir, "flash");
|
remove_file(dir, "flash");
|
||||||
remove_file(dir, "atomic_counters");
|
remove_file(dir, "atomic_counters");
|
||||||
d_delete(dir);
|
d_delete(dir);
|
||||||
ret = simple_rmdir(root->d_inode, dir);
|
ret = simple_rmdir(d_inode(root), dir);
|
||||||
|
|
||||||
bail:
|
bail:
|
||||||
mutex_unlock(&root->d_inode->i_mutex);
|
mutex_unlock(&d_inode(root)->i_mutex);
|
||||||
dput(root);
|
dput(root);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -89,14 +89,14 @@ static int create_file(const char *name, umode_t mode,
|
|||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
mutex_lock(&parent->d_inode->i_mutex);
|
mutex_lock(&d_inode(parent)->i_mutex);
|
||||||
*dentry = lookup_one_len(name, parent, strlen(name));
|
*dentry = lookup_one_len(name, parent, strlen(name));
|
||||||
if (!IS_ERR(*dentry))
|
if (!IS_ERR(*dentry))
|
||||||
error = qibfs_mknod(parent->d_inode, *dentry,
|
error = qibfs_mknod(d_inode(parent), *dentry,
|
||||||
mode, fops, data);
|
mode, fops, data);
|
||||||
else
|
else
|
||||||
error = PTR_ERR(*dentry);
|
error = PTR_ERR(*dentry);
|
||||||
mutex_unlock(&parent->d_inode->i_mutex);
|
mutex_unlock(&d_inode(parent)->i_mutex);
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
@ -455,10 +455,10 @@ static int remove_file(struct dentry *parent, char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
spin_lock(&tmp->d_lock);
|
spin_lock(&tmp->d_lock);
|
||||||
if (!d_unhashed(tmp) && tmp->d_inode) {
|
if (!d_unhashed(tmp) && d_really_is_positive(tmp)) {
|
||||||
__d_drop(tmp);
|
__d_drop(tmp);
|
||||||
spin_unlock(&tmp->d_lock);
|
spin_unlock(&tmp->d_lock);
|
||||||
simple_unlink(parent->d_inode, tmp);
|
simple_unlink(d_inode(parent), tmp);
|
||||||
} else {
|
} else {
|
||||||
spin_unlock(&tmp->d_lock);
|
spin_unlock(&tmp->d_lock);
|
||||||
}
|
}
|
||||||
@ -481,7 +481,7 @@ static int remove_device_files(struct super_block *sb,
|
|||||||
int ret, i;
|
int ret, i;
|
||||||
|
|
||||||
root = dget(sb->s_root);
|
root = dget(sb->s_root);
|
||||||
mutex_lock(&root->d_inode->i_mutex);
|
mutex_lock(&d_inode(root)->i_mutex);
|
||||||
snprintf(unit, sizeof(unit), "%u", dd->unit);
|
snprintf(unit, sizeof(unit), "%u", dd->unit);
|
||||||
dir = lookup_one_len(unit, root, strlen(unit));
|
dir = lookup_one_len(unit, root, strlen(unit));
|
||||||
|
|
||||||
@ -491,7 +491,7 @@ static int remove_device_files(struct super_block *sb,
|
|||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_lock(&dir->d_inode->i_mutex);
|
mutex_lock(&d_inode(dir)->i_mutex);
|
||||||
remove_file(dir, "counters");
|
remove_file(dir, "counters");
|
||||||
remove_file(dir, "counter_names");
|
remove_file(dir, "counter_names");
|
||||||
remove_file(dir, "portcounter_names");
|
remove_file(dir, "portcounter_names");
|
||||||
@ -506,13 +506,13 @@ static int remove_device_files(struct super_block *sb,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
remove_file(dir, "flash");
|
remove_file(dir, "flash");
|
||||||
mutex_unlock(&dir->d_inode->i_mutex);
|
mutex_unlock(&d_inode(dir)->i_mutex);
|
||||||
ret = simple_rmdir(root->d_inode, dir);
|
ret = simple_rmdir(d_inode(root), dir);
|
||||||
d_delete(dir);
|
d_delete(dir);
|
||||||
dput(dir);
|
dput(dir);
|
||||||
|
|
||||||
bail:
|
bail:
|
||||||
mutex_unlock(&root->d_inode->i_mutex);
|
mutex_unlock(&d_inode(root)->i_mutex);
|
||||||
dput(root);
|
dput(root);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -138,22 +138,22 @@ static int __oprofilefs_create_file(struct dentry *root, char const *name,
|
|||||||
struct dentry *dentry;
|
struct dentry *dentry;
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
|
|
||||||
mutex_lock(&root->d_inode->i_mutex);
|
mutex_lock(&d_inode(root)->i_mutex);
|
||||||
dentry = d_alloc_name(root, name);
|
dentry = d_alloc_name(root, name);
|
||||||
if (!dentry) {
|
if (!dentry) {
|
||||||
mutex_unlock(&root->d_inode->i_mutex);
|
mutex_unlock(&d_inode(root)->i_mutex);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
inode = oprofilefs_get_inode(root->d_sb, S_IFREG | perm);
|
inode = oprofilefs_get_inode(root->d_sb, S_IFREG | perm);
|
||||||
if (!inode) {
|
if (!inode) {
|
||||||
dput(dentry);
|
dput(dentry);
|
||||||
mutex_unlock(&root->d_inode->i_mutex);
|
mutex_unlock(&d_inode(root)->i_mutex);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
inode->i_fop = fops;
|
inode->i_fop = fops;
|
||||||
inode->i_private = priv;
|
inode->i_private = priv;
|
||||||
d_add(dentry, inode);
|
d_add(dentry, inode);
|
||||||
mutex_unlock(&root->d_inode->i_mutex);
|
mutex_unlock(&d_inode(root)->i_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,22 +215,22 @@ struct dentry *oprofilefs_mkdir(struct dentry *parent, char const *name)
|
|||||||
struct dentry *dentry;
|
struct dentry *dentry;
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
|
|
||||||
mutex_lock(&parent->d_inode->i_mutex);
|
mutex_lock(&d_inode(parent)->i_mutex);
|
||||||
dentry = d_alloc_name(parent, name);
|
dentry = d_alloc_name(parent, name);
|
||||||
if (!dentry) {
|
if (!dentry) {
|
||||||
mutex_unlock(&parent->d_inode->i_mutex);
|
mutex_unlock(&d_inode(parent)->i_mutex);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
inode = oprofilefs_get_inode(parent->d_sb, S_IFDIR | 0755);
|
inode = oprofilefs_get_inode(parent->d_sb, S_IFDIR | 0755);
|
||||||
if (!inode) {
|
if (!inode) {
|
||||||
dput(dentry);
|
dput(dentry);
|
||||||
mutex_unlock(&parent->d_inode->i_mutex);
|
mutex_unlock(&d_inode(parent)->i_mutex);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
inode->i_op = &simple_dir_inode_operations;
|
inode->i_op = &simple_dir_inode_operations;
|
||||||
inode->i_fop = &simple_dir_operations;
|
inode->i_fop = &simple_dir_operations;
|
||||||
d_add(dentry, inode);
|
d_add(dentry, inode);
|
||||||
mutex_unlock(&parent->d_inode->i_mutex);
|
mutex_unlock(&d_inode(parent)->i_mutex);
|
||||||
return dentry;
|
return dentry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1505,7 +1505,7 @@ static void destroy_ep_files (struct dev_data *dev)
|
|||||||
list_del_init (&ep->epfiles);
|
list_del_init (&ep->epfiles);
|
||||||
dentry = ep->dentry;
|
dentry = ep->dentry;
|
||||||
ep->dentry = NULL;
|
ep->dentry = NULL;
|
||||||
parent = dentry->d_parent->d_inode;
|
parent = d_inode(dentry->d_parent);
|
||||||
|
|
||||||
/* break link to controller */
|
/* break link to controller */
|
||||||
if (ep->state == STATE_EP_ENABLED)
|
if (ep->state == STATE_EP_ENABLED)
|
||||||
|
@ -603,7 +603,7 @@ static void kill_node(Node *e)
|
|||||||
write_unlock(&entries_lock);
|
write_unlock(&entries_lock);
|
||||||
|
|
||||||
if (dentry) {
|
if (dentry) {
|
||||||
drop_nlink(dentry->d_inode);
|
drop_nlink(d_inode(dentry));
|
||||||
d_drop(dentry);
|
d_drop(dentry);
|
||||||
dput(dentry);
|
dput(dentry);
|
||||||
simple_release_fs(&bm_mnt, &entry_count);
|
simple_release_fs(&bm_mnt, &entry_count);
|
||||||
@ -650,11 +650,11 @@ static ssize_t bm_entry_write(struct file *file, const char __user *buffer,
|
|||||||
case 3:
|
case 3:
|
||||||
/* Delete this handler. */
|
/* Delete this handler. */
|
||||||
root = dget(file->f_path.dentry->d_sb->s_root);
|
root = dget(file->f_path.dentry->d_sb->s_root);
|
||||||
mutex_lock(&root->d_inode->i_mutex);
|
mutex_lock(&d_inode(root)->i_mutex);
|
||||||
|
|
||||||
kill_node(e);
|
kill_node(e);
|
||||||
|
|
||||||
mutex_unlock(&root->d_inode->i_mutex);
|
mutex_unlock(&d_inode(root)->i_mutex);
|
||||||
dput(root);
|
dput(root);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -687,14 +687,14 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
|
|||||||
return PTR_ERR(e);
|
return PTR_ERR(e);
|
||||||
|
|
||||||
root = dget(sb->s_root);
|
root = dget(sb->s_root);
|
||||||
mutex_lock(&root->d_inode->i_mutex);
|
mutex_lock(&d_inode(root)->i_mutex);
|
||||||
dentry = lookup_one_len(e->name, root, strlen(e->name));
|
dentry = lookup_one_len(e->name, root, strlen(e->name));
|
||||||
err = PTR_ERR(dentry);
|
err = PTR_ERR(dentry);
|
||||||
if (IS_ERR(dentry))
|
if (IS_ERR(dentry))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
err = -EEXIST;
|
err = -EEXIST;
|
||||||
if (dentry->d_inode)
|
if (d_really_is_positive(dentry))
|
||||||
goto out2;
|
goto out2;
|
||||||
|
|
||||||
inode = bm_get_inode(sb, S_IFREG | 0644);
|
inode = bm_get_inode(sb, S_IFREG | 0644);
|
||||||
@ -723,7 +723,7 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
|
|||||||
out2:
|
out2:
|
||||||
dput(dentry);
|
dput(dentry);
|
||||||
out:
|
out:
|
||||||
mutex_unlock(&root->d_inode->i_mutex);
|
mutex_unlock(&d_inode(root)->i_mutex);
|
||||||
dput(root);
|
dput(root);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -766,12 +766,12 @@ static ssize_t bm_status_write(struct file *file, const char __user *buffer,
|
|||||||
case 3:
|
case 3:
|
||||||
/* Delete all handlers. */
|
/* Delete all handlers. */
|
||||||
root = dget(file->f_path.dentry->d_sb->s_root);
|
root = dget(file->f_path.dentry->d_sb->s_root);
|
||||||
mutex_lock(&root->d_inode->i_mutex);
|
mutex_lock(&d_inode(root)->i_mutex);
|
||||||
|
|
||||||
while (!list_empty(&entries))
|
while (!list_empty(&entries))
|
||||||
kill_node(list_entry(entries.next, Node, list));
|
kill_node(list_entry(entries.next, Node, list));
|
||||||
|
|
||||||
mutex_unlock(&root->d_inode->i_mutex);
|
mutex_unlock(&d_inode(root)->i_mutex);
|
||||||
dput(root);
|
dput(root);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -13,7 +13,7 @@ static const struct file_operations ns_file_operations = {
|
|||||||
|
|
||||||
static char *ns_dname(struct dentry *dentry, char *buffer, int buflen)
|
static char *ns_dname(struct dentry *dentry, char *buffer, int buflen)
|
||||||
{
|
{
|
||||||
struct inode *inode = dentry->d_inode;
|
struct inode *inode = d_inode(dentry);
|
||||||
const struct proc_ns_operations *ns_ops = dentry->d_fsdata;
|
const struct proc_ns_operations *ns_ops = dentry->d_fsdata;
|
||||||
|
|
||||||
return dynamic_dname(dentry, buffer, buflen, "%s:[%lu]",
|
return dynamic_dname(dentry, buffer, buflen, "%s:[%lu]",
|
||||||
@ -22,7 +22,7 @@ static char *ns_dname(struct dentry *dentry, char *buffer, int buflen)
|
|||||||
|
|
||||||
static void ns_prune_dentry(struct dentry *dentry)
|
static void ns_prune_dentry(struct dentry *dentry)
|
||||||
{
|
{
|
||||||
struct inode *inode = dentry->d_inode;
|
struct inode *inode = d_inode(dentry);
|
||||||
if (inode) {
|
if (inode) {
|
||||||
struct ns_common *ns = inode->i_private;
|
struct ns_common *ns = inode->i_private;
|
||||||
atomic_long_set(&ns->stashed, 0);
|
atomic_long_set(&ns->stashed, 0);
|
||||||
|
@ -627,7 +627,7 @@ static struct vfsmount *pipe_mnt __read_mostly;
|
|||||||
static char *pipefs_dname(struct dentry *dentry, char *buffer, int buflen)
|
static char *pipefs_dname(struct dentry *dentry, char *buffer, int buflen)
|
||||||
{
|
{
|
||||||
return dynamic_dname(dentry, buffer, buflen, "pipe:[%lu]",
|
return dynamic_dname(dentry, buffer, buflen, "pipe:[%lu]",
|
||||||
dentry->d_inode->i_ino);
|
d_inode(dentry)->i_ino);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct dentry_operations pipefs_dentry_operations = {
|
static const struct dentry_operations pipefs_dentry_operations = {
|
||||||
|
22
ipc/mqueue.c
22
ipc/mqueue.c
@ -466,7 +466,7 @@ static int mqueue_create(struct inode *dir, struct dentry *dentry,
|
|||||||
|
|
||||||
static int mqueue_unlink(struct inode *dir, struct dentry *dentry)
|
static int mqueue_unlink(struct inode *dir, struct dentry *dentry)
|
||||||
{
|
{
|
||||||
struct inode *inode = dentry->d_inode;
|
struct inode *inode = d_inode(dentry);
|
||||||
|
|
||||||
dir->i_ctime = dir->i_mtime = dir->i_atime = CURRENT_TIME;
|
dir->i_ctime = dir->i_mtime = dir->i_atime = CURRENT_TIME;
|
||||||
dir->i_size -= DIRENT_SIZE;
|
dir->i_size -= DIRENT_SIZE;
|
||||||
@ -770,7 +770,7 @@ static struct file *do_open(struct path *path, int oflag)
|
|||||||
if ((oflag & O_ACCMODE) == (O_RDWR | O_WRONLY))
|
if ((oflag & O_ACCMODE) == (O_RDWR | O_WRONLY))
|
||||||
return ERR_PTR(-EINVAL);
|
return ERR_PTR(-EINVAL);
|
||||||
acc = oflag2acc[oflag & O_ACCMODE];
|
acc = oflag2acc[oflag & O_ACCMODE];
|
||||||
if (inode_permission(path->dentry->d_inode, acc))
|
if (inode_permission(d_inode(path->dentry), acc))
|
||||||
return ERR_PTR(-EACCES);
|
return ERR_PTR(-EACCES);
|
||||||
return dentry_open(path, oflag, current_cred());
|
return dentry_open(path, oflag, current_cred());
|
||||||
}
|
}
|
||||||
@ -802,7 +802,7 @@ SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, umode_t, mode,
|
|||||||
|
|
||||||
ro = mnt_want_write(mnt); /* we'll drop it in any case */
|
ro = mnt_want_write(mnt); /* we'll drop it in any case */
|
||||||
error = 0;
|
error = 0;
|
||||||
mutex_lock(&root->d_inode->i_mutex);
|
mutex_lock(&d_inode(root)->i_mutex);
|
||||||
path.dentry = lookup_one_len(name->name, root, strlen(name->name));
|
path.dentry = lookup_one_len(name->name, root, strlen(name->name));
|
||||||
if (IS_ERR(path.dentry)) {
|
if (IS_ERR(path.dentry)) {
|
||||||
error = PTR_ERR(path.dentry);
|
error = PTR_ERR(path.dentry);
|
||||||
@ -811,7 +811,7 @@ SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, umode_t, mode,
|
|||||||
path.mnt = mntget(mnt);
|
path.mnt = mntget(mnt);
|
||||||
|
|
||||||
if (oflag & O_CREAT) {
|
if (oflag & O_CREAT) {
|
||||||
if (path.dentry->d_inode) { /* entry already exists */
|
if (d_really_is_positive(path.dentry)) { /* entry already exists */
|
||||||
audit_inode(name, path.dentry, 0);
|
audit_inode(name, path.dentry, 0);
|
||||||
if (oflag & O_EXCL) {
|
if (oflag & O_EXCL) {
|
||||||
error = -EEXIST;
|
error = -EEXIST;
|
||||||
@ -824,12 +824,12 @@ SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, umode_t, mode,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
audit_inode_parent_hidden(name, root);
|
audit_inode_parent_hidden(name, root);
|
||||||
filp = do_create(ipc_ns, root->d_inode,
|
filp = do_create(ipc_ns, d_inode(root),
|
||||||
&path, oflag, mode,
|
&path, oflag, mode,
|
||||||
u_attr ? &attr : NULL);
|
u_attr ? &attr : NULL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!path.dentry->d_inode) {
|
if (d_really_is_negative(path.dentry)) {
|
||||||
error = -ENOENT;
|
error = -ENOENT;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -848,7 +848,7 @@ SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, umode_t, mode,
|
|||||||
put_unused_fd(fd);
|
put_unused_fd(fd);
|
||||||
fd = error;
|
fd = error;
|
||||||
}
|
}
|
||||||
mutex_unlock(&root->d_inode->i_mutex);
|
mutex_unlock(&d_inode(root)->i_mutex);
|
||||||
if (!ro)
|
if (!ro)
|
||||||
mnt_drop_write(mnt);
|
mnt_drop_write(mnt);
|
||||||
out_putname:
|
out_putname:
|
||||||
@ -873,7 +873,7 @@ SYSCALL_DEFINE1(mq_unlink, const char __user *, u_name)
|
|||||||
err = mnt_want_write(mnt);
|
err = mnt_want_write(mnt);
|
||||||
if (err)
|
if (err)
|
||||||
goto out_name;
|
goto out_name;
|
||||||
mutex_lock_nested(&mnt->mnt_root->d_inode->i_mutex, I_MUTEX_PARENT);
|
mutex_lock_nested(&d_inode(mnt->mnt_root)->i_mutex, I_MUTEX_PARENT);
|
||||||
dentry = lookup_one_len(name->name, mnt->mnt_root,
|
dentry = lookup_one_len(name->name, mnt->mnt_root,
|
||||||
strlen(name->name));
|
strlen(name->name));
|
||||||
if (IS_ERR(dentry)) {
|
if (IS_ERR(dentry)) {
|
||||||
@ -881,17 +881,17 @@ SYSCALL_DEFINE1(mq_unlink, const char __user *, u_name)
|
|||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
inode = dentry->d_inode;
|
inode = d_inode(dentry);
|
||||||
if (!inode) {
|
if (!inode) {
|
||||||
err = -ENOENT;
|
err = -ENOENT;
|
||||||
} else {
|
} else {
|
||||||
ihold(inode);
|
ihold(inode);
|
||||||
err = vfs_unlink(dentry->d_parent->d_inode, dentry, NULL);
|
err = vfs_unlink(d_inode(dentry->d_parent), dentry, NULL);
|
||||||
}
|
}
|
||||||
dput(dentry);
|
dput(dentry);
|
||||||
|
|
||||||
out_unlock:
|
out_unlock:
|
||||||
mutex_unlock(&mnt->mnt_root->d_inode->i_mutex);
|
mutex_unlock(&d_inode(mnt->mnt_root)->i_mutex);
|
||||||
if (inode)
|
if (inode)
|
||||||
iput(inode);
|
iput(inode);
|
||||||
mnt_drop_write(mnt);
|
mnt_drop_write(mnt);
|
||||||
|
@ -1132,7 +1132,7 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr,
|
|||||||
path = shp->shm_file->f_path;
|
path = shp->shm_file->f_path;
|
||||||
path_get(&path);
|
path_get(&path);
|
||||||
shp->shm_nattch++;
|
shp->shm_nattch++;
|
||||||
size = i_size_read(path.dentry->d_inode);
|
size = i_size_read(d_inode(path.dentry));
|
||||||
ipc_unlock_object(&shp->shm_perm);
|
ipc_unlock_object(&shp->shm_perm);
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
|
||||||
|
30
mm/shmem.c
30
mm/shmem.c
@ -544,7 +544,7 @@ EXPORT_SYMBOL_GPL(shmem_truncate_range);
|
|||||||
|
|
||||||
static int shmem_setattr(struct dentry *dentry, struct iattr *attr)
|
static int shmem_setattr(struct dentry *dentry, struct iattr *attr)
|
||||||
{
|
{
|
||||||
struct inode *inode = dentry->d_inode;
|
struct inode *inode = d_inode(dentry);
|
||||||
struct shmem_inode_info *info = SHMEM_I(inode);
|
struct shmem_inode_info *info = SHMEM_I(inode);
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
@ -2274,7 +2274,7 @@ static int shmem_create(struct inode *dir, struct dentry *dentry, umode_t mode,
|
|||||||
*/
|
*/
|
||||||
static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
|
static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
|
||||||
{
|
{
|
||||||
struct inode *inode = old_dentry->d_inode;
|
struct inode *inode = d_inode(old_dentry);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2298,7 +2298,7 @@ static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentr
|
|||||||
|
|
||||||
static int shmem_unlink(struct inode *dir, struct dentry *dentry)
|
static int shmem_unlink(struct inode *dir, struct dentry *dentry)
|
||||||
{
|
{
|
||||||
struct inode *inode = dentry->d_inode;
|
struct inode *inode = d_inode(dentry);
|
||||||
|
|
||||||
if (inode->i_nlink > 1 && !S_ISDIR(inode->i_mode))
|
if (inode->i_nlink > 1 && !S_ISDIR(inode->i_mode))
|
||||||
shmem_free_inode(inode->i_sb);
|
shmem_free_inode(inode->i_sb);
|
||||||
@ -2315,7 +2315,7 @@ static int shmem_rmdir(struct inode *dir, struct dentry *dentry)
|
|||||||
if (!simple_empty(dentry))
|
if (!simple_empty(dentry))
|
||||||
return -ENOTEMPTY;
|
return -ENOTEMPTY;
|
||||||
|
|
||||||
drop_nlink(dentry->d_inode);
|
drop_nlink(d_inode(dentry));
|
||||||
drop_nlink(dir);
|
drop_nlink(dir);
|
||||||
return shmem_unlink(dir, dentry);
|
return shmem_unlink(dir, dentry);
|
||||||
}
|
}
|
||||||
@ -2336,8 +2336,8 @@ static int shmem_exchange(struct inode *old_dir, struct dentry *old_dentry, stru
|
|||||||
}
|
}
|
||||||
old_dir->i_ctime = old_dir->i_mtime =
|
old_dir->i_ctime = old_dir->i_mtime =
|
||||||
new_dir->i_ctime = new_dir->i_mtime =
|
new_dir->i_ctime = new_dir->i_mtime =
|
||||||
old_dentry->d_inode->i_ctime =
|
d_inode(old_dentry)->i_ctime =
|
||||||
new_dentry->d_inode->i_ctime = CURRENT_TIME;
|
d_inode(new_dentry)->i_ctime = CURRENT_TIME;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2376,7 +2376,7 @@ static int shmem_whiteout(struct inode *old_dir, struct dentry *old_dentry)
|
|||||||
*/
|
*/
|
||||||
static int shmem_rename2(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry, unsigned int flags)
|
static int shmem_rename2(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry, unsigned int flags)
|
||||||
{
|
{
|
||||||
struct inode *inode = old_dentry->d_inode;
|
struct inode *inode = d_inode(old_dentry);
|
||||||
int they_are_dirs = S_ISDIR(inode->i_mode);
|
int they_are_dirs = S_ISDIR(inode->i_mode);
|
||||||
|
|
||||||
if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE | RENAME_WHITEOUT))
|
if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE | RENAME_WHITEOUT))
|
||||||
@ -2396,10 +2396,10 @@ static int shmem_rename2(struct inode *old_dir, struct dentry *old_dentry, struc
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_dentry->d_inode) {
|
if (d_really_is_positive(new_dentry)) {
|
||||||
(void) shmem_unlink(new_dir, new_dentry);
|
(void) shmem_unlink(new_dir, new_dentry);
|
||||||
if (they_are_dirs) {
|
if (they_are_dirs) {
|
||||||
drop_nlink(new_dentry->d_inode);
|
drop_nlink(d_inode(new_dentry));
|
||||||
drop_nlink(old_dir);
|
drop_nlink(old_dir);
|
||||||
}
|
}
|
||||||
} else if (they_are_dirs) {
|
} else if (they_are_dirs) {
|
||||||
@ -2476,14 +2476,14 @@ static int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *s
|
|||||||
|
|
||||||
static void *shmem_follow_short_symlink(struct dentry *dentry, struct nameidata *nd)
|
static void *shmem_follow_short_symlink(struct dentry *dentry, struct nameidata *nd)
|
||||||
{
|
{
|
||||||
nd_set_link(nd, SHMEM_I(dentry->d_inode)->symlink);
|
nd_set_link(nd, SHMEM_I(d_inode(dentry))->symlink);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *shmem_follow_link(struct dentry *dentry, struct nameidata *nd)
|
static void *shmem_follow_link(struct dentry *dentry, struct nameidata *nd)
|
||||||
{
|
{
|
||||||
struct page *page = NULL;
|
struct page *page = NULL;
|
||||||
int error = shmem_getpage(dentry->d_inode, 0, &page, SGP_READ, NULL);
|
int error = shmem_getpage(d_inode(dentry), 0, &page, SGP_READ, NULL);
|
||||||
nd_set_link(nd, error ? ERR_PTR(error) : kmap(page));
|
nd_set_link(nd, error ? ERR_PTR(error) : kmap(page));
|
||||||
if (page)
|
if (page)
|
||||||
unlock_page(page);
|
unlock_page(page);
|
||||||
@ -2574,7 +2574,7 @@ static int shmem_xattr_validate(const char *name)
|
|||||||
static ssize_t shmem_getxattr(struct dentry *dentry, const char *name,
|
static ssize_t shmem_getxattr(struct dentry *dentry, const char *name,
|
||||||
void *buffer, size_t size)
|
void *buffer, size_t size)
|
||||||
{
|
{
|
||||||
struct shmem_inode_info *info = SHMEM_I(dentry->d_inode);
|
struct shmem_inode_info *info = SHMEM_I(d_inode(dentry));
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2595,7 +2595,7 @@ static ssize_t shmem_getxattr(struct dentry *dentry, const char *name,
|
|||||||
static int shmem_setxattr(struct dentry *dentry, const char *name,
|
static int shmem_setxattr(struct dentry *dentry, const char *name,
|
||||||
const void *value, size_t size, int flags)
|
const void *value, size_t size, int flags)
|
||||||
{
|
{
|
||||||
struct shmem_inode_info *info = SHMEM_I(dentry->d_inode);
|
struct shmem_inode_info *info = SHMEM_I(d_inode(dentry));
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2615,7 +2615,7 @@ static int shmem_setxattr(struct dentry *dentry, const char *name,
|
|||||||
|
|
||||||
static int shmem_removexattr(struct dentry *dentry, const char *name)
|
static int shmem_removexattr(struct dentry *dentry, const char *name)
|
||||||
{
|
{
|
||||||
struct shmem_inode_info *info = SHMEM_I(dentry->d_inode);
|
struct shmem_inode_info *info = SHMEM_I(d_inode(dentry));
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2635,7 +2635,7 @@ static int shmem_removexattr(struct dentry *dentry, const char *name)
|
|||||||
|
|
||||||
static ssize_t shmem_listxattr(struct dentry *dentry, char *buffer, size_t size)
|
static ssize_t shmem_listxattr(struct dentry *dentry, char *buffer, size_t size)
|
||||||
{
|
{
|
||||||
struct shmem_inode_info *info = SHMEM_I(dentry->d_inode);
|
struct shmem_inode_info *info = SHMEM_I(d_inode(dentry));
|
||||||
return simple_xattr_list(&info->xattrs, buffer, size);
|
return simple_xattr_list(&info->xattrs, buffer, size);
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_TMPFS_XATTR */
|
#endif /* CONFIG_TMPFS_XATTR */
|
||||||
|
Loading…
Reference in New Issue
Block a user