Commit ae842501 authored by Al Viro's avatar Al Viro
Browse files

Merge branches 'work.path' and 'work.mount' into work.f_path

Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ __bpf_kfunc void bpf_put_file(struct file *file)
 * pathname in *buf*, including the NUL termination character. On error, a
 * negative integer is returned.
 */
__bpf_kfunc int bpf_path_d_path(struct path *path, char *buf, size_t buf__sz)
__bpf_kfunc int bpf_path_d_path(const struct path *path, char *buf, size_t buf__sz)
{
	int len;
	char *ret;
+13 −20
Original line number Diff line number Diff line
@@ -114,26 +114,21 @@ static int create_link(struct config_item *parent_item,
}


static int get_target(const char *symname, struct path *path,
		      struct config_item **target, struct super_block *sb)
static int get_target(const char *symname, struct config_item **target,
		      struct super_block *sb)
{
	struct path path __free(path_put) = {};
	int ret;

	ret = kern_path(symname, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, path);
	if (!ret) {
		if (path->dentry->d_sb == sb) {
			*target = configfs_get_config_item(path->dentry);
			if (!*target) {
				ret = -ENOENT;
				path_put(path);
			}
		} else {
			ret = -EPERM;
			path_put(path);
		}
	}

	ret = kern_path(symname, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &path);
	if (ret)
		return ret;
	if (path.dentry->d_sb != sb)
		return -EPERM;
	*target = configfs_get_config_item(path.dentry);
	if (!*target)
		return -ENOENT;
	return 0;
}


@@ -141,7 +136,6 @@ int configfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
		     struct dentry *dentry, const char *symname)
{
	int ret;
	struct path path;
	struct configfs_dirent *sd;
	struct config_item *parent_item;
	struct config_item *target_item = NULL;
@@ -188,7 +182,7 @@ int configfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
	 *  AV, a thoroughly annoyed bastard.
	 */
	inode_unlock(dir);
	ret = get_target(symname, &path, &target_item, dentry->d_sb);
	ret = get_target(symname, &target_item, dentry->d_sb);
	inode_lock(dir);
	if (ret)
		goto out_put;
@@ -210,7 +204,6 @@ int configfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
	}

	config_item_put(target_item);
	path_put(&path);

out_put:
	config_item_put(parent_item);
+2 −2
Original line number Diff line number Diff line
@@ -1390,6 +1390,7 @@ struct check_mount {
	unsigned int mounted;
};

/* locks: mount_locked_reader && dentry->d_lock */
static enum d_walk_ret path_check_mount(void *data, struct dentry *dentry)
{
	struct check_mount *info = data;
@@ -1416,9 +1417,8 @@ int path_has_submounts(const struct path *parent)
{
	struct check_mount data = { .mnt = parent->mnt, .mounted = 0 };

	read_seqlock_excl(&mount_lock);
	guard(mount_locked_reader)();
	d_walk(parent->dentry, &data, path_check_mount);
	read_sequnlock_excl(&mount_lock);

	return data.mounted;
}
+1 −13
Original line number Diff line number Diff line
@@ -59,14 +59,6 @@ static int ecryptfs_d_revalidate(struct inode *dir, const struct qstr *name,
	return rc;
}

struct kmem_cache *ecryptfs_dentry_info_cache;

static void ecryptfs_dentry_free_rcu(struct rcu_head *head)
{
	kmem_cache_free(ecryptfs_dentry_info_cache,
		container_of(head, struct ecryptfs_dentry_info, rcu));
}

/**
 * ecryptfs_d_release
 * @dentry: The ecryptfs dentry
@@ -75,11 +67,7 @@ static void ecryptfs_dentry_free_rcu(struct rcu_head *head)
 */
static void ecryptfs_d_release(struct dentry *dentry)
{
	struct ecryptfs_dentry_info *p = dentry->d_fsdata;
	if (p) {
		path_put(&p->lower_path);
		call_rcu(&p->rcu, ecryptfs_dentry_free_rcu);
	}
	dput(dentry->d_fsdata);
}

const struct dentry_operations ecryptfs_dops = {
+11 −16
Original line number Diff line number Diff line
@@ -258,13 +258,6 @@ struct ecryptfs_inode_info {
	struct ecryptfs_crypt_stat crypt_stat;
};

/* dentry private data. Each dentry must keep track of a lower
 * vfsmount too. */
struct ecryptfs_dentry_info {
	struct path lower_path;
	struct rcu_head rcu;
};

/**
 * ecryptfs_global_auth_tok - A key used to encrypt all new files under the mountpoint
 * @flags: Status flags
@@ -348,6 +341,7 @@ struct ecryptfs_mount_crypt_stat {
/* superblock private data. */
struct ecryptfs_sb_info {
	struct super_block *wsi_sb;
	struct vfsmount *lower_mnt;
	struct ecryptfs_mount_crypt_stat mount_crypt_stat;
};

@@ -494,22 +488,25 @@ ecryptfs_set_superblock_lower(struct super_block *sb,
}

static inline void
ecryptfs_set_dentry_private(struct dentry *dentry,
			    struct ecryptfs_dentry_info *dentry_info)
ecryptfs_set_dentry_lower(struct dentry *dentry,
			  struct dentry *lower_dentry)
{
	dentry->d_fsdata = dentry_info;
	dentry->d_fsdata = lower_dentry;
}

static inline struct dentry *
ecryptfs_dentry_to_lower(struct dentry *dentry)
{
	return ((struct ecryptfs_dentry_info *)dentry->d_fsdata)->lower_path.dentry;
	return dentry->d_fsdata;
}

static inline const struct path *
ecryptfs_dentry_to_lower_path(struct dentry *dentry)
static inline struct path
ecryptfs_lower_path(struct dentry *dentry)
{
	return &((struct ecryptfs_dentry_info *)dentry->d_fsdata)->lower_path;
	return (struct path){
		.mnt = ecryptfs_superblock_to_private(dentry->d_sb)->lower_mnt,
		.dentry = ecryptfs_dentry_to_lower(dentry)
	};
}

#define ecryptfs_printk(type, fmt, arg...) \
@@ -532,7 +529,6 @@ extern unsigned int ecryptfs_number_of_users;

extern struct kmem_cache *ecryptfs_auth_tok_list_item_cache;
extern struct kmem_cache *ecryptfs_file_info_cache;
extern struct kmem_cache *ecryptfs_dentry_info_cache;
extern struct kmem_cache *ecryptfs_inode_info_cache;
extern struct kmem_cache *ecryptfs_sb_info_cache;
extern struct kmem_cache *ecryptfs_header_cache;
@@ -557,7 +553,6 @@ int ecryptfs_encrypt_and_encode_filename(
	size_t *encoded_name_size,
	struct ecryptfs_mount_crypt_stat *mount_crypt_stat,
	const char *name, size_t name_size);
struct dentry *ecryptfs_lower_dentry(struct dentry *this_dentry);
void ecryptfs_dump_hex(char *data, int bytes);
int virt_to_scatterlist(const void *addr, int size, struct scatterlist *sg,
			int sg_size);
Loading