mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	ovl: grab reference to workbasedir early
and related cleanups. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
		
							parent
							
								
									f7e3a7d947
								
							
						
					
					
						commit
						95e6d4177c
					
				
					 1 changed files with 8 additions and 7 deletions
				
			
		| 
						 | 
					@ -889,7 +889,7 @@ static int ovl_get_workpath(struct ovl_fs *ufs, struct path *upperpath,
 | 
				
			||||||
		pr_warn("overlayfs: workdir is in-use by another mount, accessing files from both mounts will result in undefined behavior.\n");
 | 
							pr_warn("overlayfs: workdir is in-use by another mount, accessing files from both mounts will result in undefined behavior.\n");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ufs->workbasedir = workpath->dentry;
 | 
						ufs->workbasedir = dget(workpath->dentry);
 | 
				
			||||||
	err = 0;
 | 
						err = 0;
 | 
				
			||||||
out:
 | 
					out:
 | 
				
			||||||
	return err;
 | 
						return err;
 | 
				
			||||||
| 
						 | 
					@ -918,7 +918,7 @@ static int ovl_get_workdir(struct super_block *sb, struct ovl_fs *ufs,
 | 
				
			||||||
	struct dentry *temp;
 | 
						struct dentry *temp;
 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ufs->workdir = ovl_workdir_create(sb, ufs, workpath->dentry,
 | 
						ufs->workdir = ovl_workdir_create(sb, ufs, ufs->workbasedir,
 | 
				
			||||||
					  OVL_WORKDIR_NAME, false);
 | 
										  OVL_WORKDIR_NAME, false);
 | 
				
			||||||
	if (!ufs->workdir)
 | 
						if (!ufs->workdir)
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
| 
						 | 
					@ -971,7 +971,7 @@ static int ovl_get_workdir(struct super_block *sb, struct ovl_fs *ufs,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int ovl_get_indexdir(struct super_block *sb, struct ovl_fs *ufs,
 | 
					static int ovl_get_indexdir(struct super_block *sb, struct ovl_fs *ufs,
 | 
				
			||||||
			    struct ovl_entry *oe,
 | 
								    struct ovl_entry *oe,
 | 
				
			||||||
			    struct path *upperpath, struct path *workpath)
 | 
								    struct path *upperpath)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -985,7 +985,7 @@ static int ovl_get_indexdir(struct super_block *sb, struct ovl_fs *ufs,
 | 
				
			||||||
		goto out;
 | 
							goto out;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ufs->indexdir = ovl_workdir_create(sb, ufs, workpath->dentry,
 | 
						ufs->indexdir = ovl_workdir_create(sb, ufs, ufs->workbasedir,
 | 
				
			||||||
					   OVL_INDEXDIR_NAME, true);
 | 
										   OVL_INDEXDIR_NAME, true);
 | 
				
			||||||
	if (ufs->indexdir) {
 | 
						if (ufs->indexdir) {
 | 
				
			||||||
		/* Verify upper root is index dir origin */
 | 
							/* Verify upper root is index dir origin */
 | 
				
			||||||
| 
						 | 
					@ -1212,7 +1212,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!(ovl_force_readonly(ufs)) && ufs->config.index) {
 | 
						if (!(ovl_force_readonly(ufs)) && ufs->config.index) {
 | 
				
			||||||
		err = ovl_get_indexdir(sb, ufs, oe, &upperpath, &workpath);
 | 
							err = ovl_get_indexdir(sb, ufs, oe, &upperpath);
 | 
				
			||||||
		if (err)
 | 
							if (err)
 | 
				
			||||||
			goto out_put_indexdir;
 | 
								goto out_put_indexdir;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -1243,7 +1243,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
 | 
				
			||||||
	for (i = 0; i < numlower; i++)
 | 
						for (i = 0; i < numlower; i++)
 | 
				
			||||||
		mntput(stack[i].mnt);
 | 
							mntput(stack[i].mnt);
 | 
				
			||||||
	kfree(stack);
 | 
						kfree(stack);
 | 
				
			||||||
	mntput(workpath.mnt);
 | 
						path_put(&workpath);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (upperpath.dentry) {
 | 
						if (upperpath.dentry) {
 | 
				
			||||||
		oe->has_upper = true;
 | 
							oe->has_upper = true;
 | 
				
			||||||
| 
						 | 
					@ -1283,7 +1283,8 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
 | 
				
			||||||
	kfree(stack);
 | 
						kfree(stack);
 | 
				
			||||||
out_unlock_workdentry:
 | 
					out_unlock_workdentry:
 | 
				
			||||||
	if (ufs->workdir_locked)
 | 
						if (ufs->workdir_locked)
 | 
				
			||||||
		ovl_inuse_unlock(workpath.dentry);
 | 
							ovl_inuse_unlock(ufs->workbasedir);
 | 
				
			||||||
 | 
						dput(ufs->workbasedir);
 | 
				
			||||||
	path_put(&workpath);
 | 
						path_put(&workpath);
 | 
				
			||||||
out_unlock_upperdentry:
 | 
					out_unlock_upperdentry:
 | 
				
			||||||
	if (ufs->upperdir_locked)
 | 
						if (ufs->upperdir_locked)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue