Skip to content

Commit 5af568c

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: isofs: Fix lseek() to position beyond 4 GB vfs: remove unused MNT_STRICTATIME vfs: show unreachable paths in getcwd and proc vfs: only add " (deleted)" where necessary vfs: add prepend_path() helper vfs: __d_path: dont prepend the name of the root dentry ia64: perfmon: add d_dname method vfs: add helpers to get root and pwd cachefiles: use path_get instead of lone dget fs/sysv/super.c: add support for non-PDP11 v7 filesystems V7: Adjust sanity checks for some volumes Add v7 alias v9fs: fixup for inode_setattr being removed Manual merge to take Al's version of the fs/sysv/super.c file: it merged cleanly, but Al had removed an unnecessary header include, so his side was better.
2 parents 062e27e + 66a362a commit 5af568c

File tree

15 files changed

+223
-130
lines changed

15 files changed

+223
-130
lines changed

arch/ia64/kernel/perfmon.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2191,8 +2191,15 @@ pfmfs_delete_dentry(struct dentry *dentry)
21912191
return 1;
21922192
}
21932193

2194+
static char *pfmfs_dname(struct dentry *dentry, char *buffer, int buflen)
2195+
{
2196+
return dynamic_dname(dentry, buffer, buflen, "pfm:[%lu]",
2197+
dentry->d_inode->i_ino);
2198+
}
2199+
21942200
static const struct dentry_operations pfmfs_dentry_operations = {
21952201
.d_delete = pfmfs_delete_dentry,
2202+
.d_dname = pfmfs_dname,
21962203
};
21972204

21982205

@@ -2202,8 +2209,7 @@ pfm_alloc_file(pfm_context_t *ctx)
22022209
struct file *file;
22032210
struct inode *inode;
22042211
struct path path;
2205-
char name[32];
2206-
struct qstr this;
2212+
struct qstr this = { .name = "" };
22072213

22082214
/*
22092215
* allocate a new inode
@@ -2218,11 +2224,6 @@ pfm_alloc_file(pfm_context_t *ctx)
22182224
inode->i_uid = current_fsuid();
22192225
inode->i_gid = current_fsgid();
22202226

2221-
sprintf(name, "[%lu]", inode->i_ino);
2222-
this.name = name;
2223-
this.len = strlen(name);
2224-
this.hash = inode->i_ino;
2225-
22262227
/*
22272228
* allocate a new dcache entry
22282229
*/

fs/9p/vfs_inode.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,10 +1263,19 @@ static int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
12631263
return PTR_ERR(fid);
12641264

12651265
retval = p9_client_setattr(fid, &p9attr);
1266-
if (retval >= 0)
1267-
retval = inode_setattr(dentry->d_inode, iattr);
1266+
if (retval < 0)
1267+
return retval;
12681268

1269-
return retval;
1269+
if ((iattr->ia_valid & ATTR_SIZE) &&
1270+
iattr->ia_size != i_size_read(dentry->d_inode)) {
1271+
retval = vmtruncate(dentry->d_inode, iattr->ia_size);
1272+
if (retval)
1273+
return retval;
1274+
}
1275+
1276+
setattr_copy(dentry->d_inode, iattr);
1277+
mark_inode_dirty(dentry->d_inode);
1278+
return 0;
12701279
}
12711280

12721281
/**

fs/cachefiles/daemon.c

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -552,8 +552,7 @@ static int cachefiles_daemon_tag(struct cachefiles_cache *cache, char *args)
552552
*/
553553
static int cachefiles_daemon_cull(struct cachefiles_cache *cache, char *args)
554554
{
555-
struct fs_struct *fs;
556-
struct dentry *dir;
555+
struct path path;
557556
const struct cred *saved_cred;
558557
int ret;
559558

@@ -573,24 +572,21 @@ static int cachefiles_daemon_cull(struct cachefiles_cache *cache, char *args)
573572
}
574573

575574
/* extract the directory dentry from the cwd */
576-
fs = current->fs;
577-
read_lock(&fs->lock);
578-
dir = dget(fs->pwd.dentry);
579-
read_unlock(&fs->lock);
575+
get_fs_pwd(current->fs, &path);
580576

581-
if (!S_ISDIR(dir->d_inode->i_mode))
577+
if (!S_ISDIR(path.dentry->d_inode->i_mode))
582578
goto notdir;
583579

584580
cachefiles_begin_secure(cache, &saved_cred);
585-
ret = cachefiles_cull(cache, dir, args);
581+
ret = cachefiles_cull(cache, path.dentry, args);
586582
cachefiles_end_secure(cache, saved_cred);
587583

588-
dput(dir);
584+
path_put(&path);
589585
_leave(" = %d", ret);
590586
return ret;
591587

592588
notdir:
593-
dput(dir);
589+
path_put(&path);
594590
kerror("cull command requires dirfd to be a directory");
595591
return -ENOTDIR;
596592

@@ -628,8 +624,7 @@ static int cachefiles_daemon_debug(struct cachefiles_cache *cache, char *args)
628624
*/
629625
static int cachefiles_daemon_inuse(struct cachefiles_cache *cache, char *args)
630626
{
631-
struct fs_struct *fs;
632-
struct dentry *dir;
627+
struct path path;
633628
const struct cred *saved_cred;
634629
int ret;
635630

@@ -649,24 +644,21 @@ static int cachefiles_daemon_inuse(struct cachefiles_cache *cache, char *args)
649644
}
650645

651646
/* extract the directory dentry from the cwd */
652-
fs = current->fs;
653-
read_lock(&fs->lock);
654-
dir = dget(fs->pwd.dentry);
655-
read_unlock(&fs->lock);
647+
get_fs_pwd(current->fs, &path);
656648

657-
if (!S_ISDIR(dir->d_inode->i_mode))
649+
if (!S_ISDIR(path.dentry->d_inode->i_mode))
658650
goto notdir;
659651

660652
cachefiles_begin_secure(cache, &saved_cred);
661-
ret = cachefiles_check_in_use(cache, dir, args);
653+
ret = cachefiles_check_in_use(cache, path.dentry, args);
662654
cachefiles_end_secure(cache, saved_cred);
663655

664-
dput(dir);
656+
path_put(&path);
665657
//_leave(" = %d", ret);
666658
return ret;
667659

668660
notdir:
669-
dput(dir);
661+
path_put(&path);
670662
kerror("inuse command requires dirfd to be a directory");
671663
return -ENOTDIR;
672664

0 commit comments

Comments
 (0)