Commit aea187c4 authored by Linus Torvalds's avatar Linus Torvalds

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:
  CacheFiles: Fix a race in cachefiles_delete_object() vs rename
  vfs: don't call ima_file_check() unconditionally in nfsd_open()
  fs: inode - remove 8 bytes of padding on 64bits allowing 1 more objects/slab under slub
  Switch proc/self to nd_set_link()
  fix LOOKUP_FOLLOW on automount "symlinks"
parents d0708b97 8f9941ae
...@@ -348,7 +348,17 @@ int cachefiles_delete_object(struct cachefiles_cache *cache, ...@@ -348,7 +348,17 @@ int cachefiles_delete_object(struct cachefiles_cache *cache,
dir = dget_parent(object->dentry); dir = dget_parent(object->dentry);
mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT); mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT);
/* we need to check that our parent is _still_ our parent - it may have
* been renamed */
if (dir == object->dentry->d_parent) {
ret = cachefiles_bury_object(cache, dir, object->dentry); ret = cachefiles_bury_object(cache, dir, object->dentry);
} else {
/* it got moved, presumably by cachefilesd culling it, so it's
* no longer in the key path and we can ignore it */
mutex_unlock(&dir->d_inode->i_mutex);
ret = 0;
}
dput(dir); dput(dir);
_leave(" = %d", ret); _leave(" = %d", ret);
......
...@@ -822,6 +822,17 @@ static int do_lookup(struct nameidata *nd, struct qstr *name, ...@@ -822,6 +822,17 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
return PTR_ERR(dentry); return PTR_ERR(dentry);
} }
/*
* This is a temporary kludge to deal with "automount" symlinks; proper
* solution is to trigger them on follow_mount(), so that do_lookup()
* would DTRT. To be killed before 2.6.34-final.
*/
static inline int follow_on_final(struct inode *inode, unsigned lookup_flags)
{
return inode && unlikely(inode->i_op->follow_link) &&
((lookup_flags & LOOKUP_FOLLOW) || S_ISDIR(inode->i_mode));
}
/* /*
* Name resolution. * Name resolution.
* This is the basic name resolution function, turning a pathname into * This is the basic name resolution function, turning a pathname into
...@@ -942,8 +953,7 @@ static int link_path_walk(const char *name, struct nameidata *nd) ...@@ -942,8 +953,7 @@ static int link_path_walk(const char *name, struct nameidata *nd)
if (err) if (err)
break; break;
inode = next.dentry->d_inode; inode = next.dentry->d_inode;
if ((lookup_flags & LOOKUP_FOLLOW) if (follow_on_final(inode, lookup_flags)) {
&& inode && inode->i_op->follow_link) {
err = do_follow_link(&next, nd); err = do_follow_link(&next, nd);
if (err) if (err)
goto return_err; goto return_err;
......
...@@ -752,6 +752,7 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, ...@@ -752,6 +752,7 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
flags, current_cred()); flags, current_cred());
if (IS_ERR(*filp)) if (IS_ERR(*filp))
host_err = PTR_ERR(*filp); host_err = PTR_ERR(*filp);
else
host_err = ima_file_check(*filp, access); host_err = ima_file_check(*filp, access);
out_nfserr: out_nfserr:
err = nfserrno(host_err); err = nfserrno(host_err);
......
...@@ -2369,16 +2369,30 @@ static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd) ...@@ -2369,16 +2369,30 @@ static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd)
{ {
struct pid_namespace *ns = dentry->d_sb->s_fs_info; struct pid_namespace *ns = dentry->d_sb->s_fs_info;
pid_t tgid = task_tgid_nr_ns(current, ns); pid_t tgid = task_tgid_nr_ns(current, ns);
char tmp[PROC_NUMBUF]; char *name = ERR_PTR(-ENOENT);
if (!tgid) if (tgid) {
return ERR_PTR(-ENOENT); name = __getname();
sprintf(tmp, "%d", task_tgid_nr_ns(current, ns)); if (!name)
return ERR_PTR(vfs_follow_link(nd,tmp)); name = ERR_PTR(-ENOMEM);
else
sprintf(name, "%d", tgid);
}
nd_set_link(nd, name);
return NULL;
}
static void proc_self_put_link(struct dentry *dentry, struct nameidata *nd,
void *cookie)
{
char *s = nd_get_link(nd);
if (!IS_ERR(s))
__putname(s);
} }
static const struct inode_operations proc_self_inode_operations = { static const struct inode_operations proc_self_inode_operations = {
.readlink = proc_self_readlink, .readlink = proc_self_readlink,
.follow_link = proc_self_follow_link, .follow_link = proc_self_follow_link,
.put_link = proc_self_put_link,
}; };
/* /*
......
...@@ -729,6 +729,7 @@ struct inode { ...@@ -729,6 +729,7 @@ struct inode {
uid_t i_uid; uid_t i_uid;
gid_t i_gid; gid_t i_gid;
dev_t i_rdev; dev_t i_rdev;
unsigned int i_blkbits;
u64 i_version; u64 i_version;
loff_t i_size; loff_t i_size;
#ifdef __NEED_I_SIZE_ORDERED #ifdef __NEED_I_SIZE_ORDERED
...@@ -738,7 +739,6 @@ struct inode { ...@@ -738,7 +739,6 @@ struct inode {
struct timespec i_mtime; struct timespec i_mtime;
struct timespec i_ctime; struct timespec i_ctime;
blkcnt_t i_blocks; blkcnt_t i_blocks;
unsigned int i_blkbits;
unsigned short i_bytes; unsigned short i_bytes;
umode_t i_mode; umode_t i_mode;
spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment