Commit cd794539 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull vfs fixes from Al Viro:
 "A bunch of assorted fixes; Jan's freezing stuff still _not_ in there
  and neither is mm fun ;-/"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  restore smp_mb() in unlock_new_inode()
  vfs: fix return value from do_last()
  vfs: fix double put after complete_walk()
  udf: Fix deadlock in udf_release_file()
  vfs: Correctly set the dir i_mutex lockdep class
parents 2f1c2b81 310fa7a3
...@@ -938,8 +938,7 @@ void lockdep_annotate_inode_mutex_key(struct inode *inode) ...@@ -938,8 +938,7 @@ void lockdep_annotate_inode_mutex_key(struct inode *inode)
struct file_system_type *type = inode->i_sb->s_type; struct file_system_type *type = inode->i_sb->s_type;
/* Set new key only if filesystem hasn't already changed it */ /* Set new key only if filesystem hasn't already changed it */
if (!lockdep_match_class(&inode->i_mutex, if (lockdep_match_class(&inode->i_mutex, &type->i_mutex_key)) {
&type->i_mutex_key)) {
/* /*
* ensure nobody is actually holding i_mutex * ensure nobody is actually holding i_mutex
*/ */
...@@ -966,6 +965,7 @@ void unlock_new_inode(struct inode *inode) ...@@ -966,6 +965,7 @@ void unlock_new_inode(struct inode *inode)
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
WARN_ON(!(inode->i_state & I_NEW)); WARN_ON(!(inode->i_state & I_NEW));
inode->i_state &= ~I_NEW; inode->i_state &= ~I_NEW;
smp_mb();
wake_up_bit(&inode->i_state, __I_NEW); wake_up_bit(&inode->i_state, __I_NEW);
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
} }
......
...@@ -2162,7 +2162,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path, ...@@ -2162,7 +2162,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
/* sayonara */ /* sayonara */
error = complete_walk(nd); error = complete_walk(nd);
if (error) if (error)
return ERR_PTR(-ECHILD); return ERR_PTR(error);
error = -ENOTDIR; error = -ENOTDIR;
if (nd->flags & LOOKUP_DIRECTORY) { if (nd->flags & LOOKUP_DIRECTORY) {
...@@ -2261,7 +2261,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path, ...@@ -2261,7 +2261,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
/* Why this, you ask? _Now_ we might have grown LOOKUP_JUMPED... */ /* Why this, you ask? _Now_ we might have grown LOOKUP_JUMPED... */
error = complete_walk(nd); error = complete_walk(nd);
if (error) if (error)
goto exit; return ERR_PTR(error);
error = -EISDIR; error = -EISDIR;
if (S_ISDIR(nd->inode->i_mode)) if (S_ISDIR(nd->inode->i_mode))
goto exit; goto exit;
......
...@@ -201,12 +201,10 @@ long udf_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -201,12 +201,10 @@ long udf_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
static int udf_release_file(struct inode *inode, struct file *filp) static int udf_release_file(struct inode *inode, struct file *filp)
{ {
if (filp->f_mode & FMODE_WRITE) { if (filp->f_mode & FMODE_WRITE) {
mutex_lock(&inode->i_mutex);
down_write(&UDF_I(inode)->i_data_sem); down_write(&UDF_I(inode)->i_data_sem);
udf_discard_prealloc(inode); udf_discard_prealloc(inode);
udf_truncate_tail_extent(inode); udf_truncate_tail_extent(inode);
up_write(&UDF_I(inode)->i_data_sem); up_write(&UDF_I(inode)->i_data_sem);
mutex_unlock(&inode->i_mutex);
} }
return 0; return 0;
} }
......
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