Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 208883
b: refs/heads/master
c: 542ce7a
h: refs/heads/master
i:
  208881: 1d17dde
  208879: 093ae00
v: v3
  • Loading branch information
Miklos Szeredi authored and Al Viro committed Aug 11, 2010
1 parent 7748a61 commit b38c88d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6d0b5456e14ec19edae7c18de4d355c58b133bd6
refs/heads/master: 542ce7a9bc6b3838832ae0f4f8de30c667af8ff3
26 changes: 14 additions & 12 deletions trunk/fs/cachefiles/daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ static int cachefiles_daemon_tag(struct cachefiles_cache *cache, char *args)
static int cachefiles_daemon_cull(struct cachefiles_cache *cache, char *args)
{
struct fs_struct *fs;
struct dentry *dir;
struct path path;
const struct cred *saved_cred;
int ret;

Expand All @@ -575,22 +575,23 @@ static int cachefiles_daemon_cull(struct cachefiles_cache *cache, char *args)
/* extract the directory dentry from the cwd */
fs = current->fs;
read_lock(&fs->lock);
dir = dget(fs->pwd.dentry);
path = fs->pwd;
path_get(&path);
read_unlock(&fs->lock);

if (!S_ISDIR(dir->d_inode->i_mode))
if (!S_ISDIR(path.dentry->d_inode->i_mode))
goto notdir;

cachefiles_begin_secure(cache, &saved_cred);
ret = cachefiles_cull(cache, dir, args);
ret = cachefiles_cull(cache, path.dentry, args);
cachefiles_end_secure(cache, saved_cred);

dput(dir);
path_put(&path);
_leave(" = %d", ret);
return ret;

notdir:
dput(dir);
path_put(&path);
kerror("cull command requires dirfd to be a directory");
return -ENOTDIR;

Expand Down Expand Up @@ -629,7 +630,7 @@ static int cachefiles_daemon_debug(struct cachefiles_cache *cache, char *args)
static int cachefiles_daemon_inuse(struct cachefiles_cache *cache, char *args)
{
struct fs_struct *fs;
struct dentry *dir;
struct path path;
const struct cred *saved_cred;
int ret;

Expand All @@ -651,22 +652,23 @@ static int cachefiles_daemon_inuse(struct cachefiles_cache *cache, char *args)
/* extract the directory dentry from the cwd */
fs = current->fs;
read_lock(&fs->lock);
dir = dget(fs->pwd.dentry);
path = fs->pwd;
path_get(&path);
read_unlock(&fs->lock);

if (!S_ISDIR(dir->d_inode->i_mode))
if (!S_ISDIR(path.dentry->d_inode->i_mode))
goto notdir;

cachefiles_begin_secure(cache, &saved_cred);
ret = cachefiles_check_in_use(cache, dir, args);
ret = cachefiles_check_in_use(cache, path.dentry, args);
cachefiles_end_secure(cache, saved_cred);

dput(dir);
path_put(&path);
//_leave(" = %d", ret);
return ret;

notdir:
dput(dir);
path_put(&path);
kerror("inuse command requires dirfd to be a directory");
return -ENOTDIR;

Expand Down

0 comments on commit b38c88d

Please sign in to comment.