]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jan 2015 05:21:28 +0000 (21:21 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jan 2015 05:21:28 +0000 (21:21 -0800)
added patches:
arm-mvebu-disable-i-o-coherency-on-non-smp-situations-on-armada-370-375-38x-xp.patch
nilfs2-fix-the-nilfs_iget-vs.-nilfs_new_inode-races.patch
scripts-kernel-doc-don-t-eat-struct-members-with-__aligned.patch

queue-3.10/arm-mvebu-disable-i-o-coherency-on-non-smp-situations-on-armada-370-375-38x-xp.patch [new file with mode: 0644]
queue-3.10/nilfs2-fix-the-nilfs_iget-vs.-nilfs_new_inode-races.patch [new file with mode: 0644]
queue-3.10/scripts-kernel-doc-don-t-eat-struct-members-with-__aligned.patch [new file with mode: 0644]
queue-3.10/series

diff --git a/queue-3.10/arm-mvebu-disable-i-o-coherency-on-non-smp-situations-on-armada-370-375-38x-xp.patch b/queue-3.10/arm-mvebu-disable-i-o-coherency-on-non-smp-situations-on-armada-370-375-38x-xp.patch
new file mode 100644 (file)
index 0000000..8e84e77
--- /dev/null
@@ -0,0 +1,90 @@
+From e55355453600a33bb5ca4f71f2d7214875f3b061 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Thu, 13 Nov 2014 10:38:57 +0100
+Subject: ARM: mvebu: disable I/O coherency on non-SMP situations on Armada 370/375/38x/XP
+
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+
+commit e55355453600a33bb5ca4f71f2d7214875f3b061 upstream.
+
+Enabling the hardware I/O coherency on Armada 370, Armada 375, Armada
+38x and Armada XP requires a certain number of conditions:
+
+ - On Armada 370, the cache policy must be set to write-allocate.
+
+ - On Armada 375, 38x and XP, the cache policy must be set to
+   write-allocate, the pages must be mapped with the shareable
+   attribute, and the SMP bit must be set
+
+Currently, on Armada XP, when CONFIG_SMP is enabled, those conditions
+are met. However, when Armada XP is used in a !CONFIG_SMP kernel, none
+of these conditions are met. With Armada 370, the situation is worse:
+since the processor is single core, regardless of whether CONFIG_SMP
+or !CONFIG_SMP is used, the cache policy will be set to write-back by
+the kernel and not write-allocate.
+
+Since solving this problem turns out to be quite complicated, and we
+don't want to let users with a mainline kernel known to have
+infrequent but existing data corruptions, this commit proposes to
+simply disable hardware I/O coherency in situations where it is known
+not to work.
+
+And basically, the is_smp() function of the kernel tells us whether it
+is OK to enable hardware I/O coherency or not, so this commit slightly
+refactors the coherency_type() function to return
+COHERENCY_FABRIC_TYPE_NONE when is_smp() is false, or the appropriate
+type of the coherency fabric in the other case.
+
+Thanks to this, the I/O coherency fabric will no longer be used at all
+in !CONFIG_SMP configurations. It will continue to be used in
+CONFIG_SMP configurations on Armada XP, Armada 375 and Armada 38x
+(which are multiple cores processors), but will no longer be used on
+Armada 370 (which is a single core processor).
+
+In the process, it simplifies the implementation of the
+coherency_type() function, and adds a missing call to of_node_put().
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Fixes: e60304f8cb7bb545e79fe62d9b9762460c254ec2 ("arm: mvebu: Add hardware I/O Coherency support")
+Cc: <stable@vger.kernel.org> # v3.8+
+Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
+Link: https://lkml.kernel.org/r/1415871540-20302-3-git-send-email-thomas.petazzoni@free-electrons.com
+Signed-off-by: Jason Cooper <jason@lakedaemon.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/mach-mvebu/coherency.c |   23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+--- a/arch/arm/mach-mvebu/coherency.c
++++ b/arch/arm/mach-mvebu/coherency.c
+@@ -141,6 +141,29 @@ int __init coherency_init(void)
+ {
+       struct device_node *np;
++      /*
++       * The coherency fabric is needed:
++       * - For coherency between processors on Armada XP, so only
++       *   when SMP is enabled.
++       * - For coherency between the processor and I/O devices, but
++       *   this coherency requires many pre-requisites (write
++       *   allocate cache policy, shareable pages, SMP bit set) that
++       *   are only meant in SMP situations.
++       *
++       * Note that this means that on Armada 370, there is currently
++       * no way to use hardware I/O coherency, because even when
++       * CONFIG_SMP is enabled, is_smp() returns false due to the
++       * Armada 370 being a single-core processor. To lift this
++       * limitation, we would have to find a way to make the cache
++       * policy set to write-allocate (on all Armada SoCs), and to
++       * set the shareable attribute in page tables (on all Armada
++       * SoCs except the Armada 370). Unfortunately, such decisions
++       * are taken very early in the kernel boot process, at a point
++       * where we don't know yet on which SoC we are running.
++       */
++      if (!is_smp())
++              return 0;
++
+       np = of_find_matching_node(NULL, of_coherency_table);
+       if (np) {
+               pr_info("Initializing Coherency fabric\n");
diff --git a/queue-3.10/nilfs2-fix-the-nilfs_iget-vs.-nilfs_new_inode-races.patch b/queue-3.10/nilfs2-fix-the-nilfs_iget-vs.-nilfs_new_inode-races.patch
new file mode 100644 (file)
index 0000000..431dd4e
--- /dev/null
@@ -0,0 +1,176 @@
+From 705304a863cc41585508c0f476f6d3ec28cf7e00 Mon Sep 17 00:00:00 2001
+From: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
+Date: Wed, 10 Dec 2014 15:54:34 -0800
+Subject: nilfs2: fix the nilfs_iget() vs. nilfs_new_inode() races
+
+From: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
+
+commit 705304a863cc41585508c0f476f6d3ec28cf7e00 upstream.
+
+Same story as in commit 41080b5a2401 ("nfsd race fixes: ext2") (similar
+ext2 fix) except that nilfs2 needs to use insert_inode_locked4() instead
+of insert_inode_locked() and a bug of a check for dead inodes needs to
+be fixed.
+
+If nilfs_iget() is called from nfsd after nilfs_new_inode() calls
+insert_inode_locked4(), nilfs_iget() will wait for unlock_new_inode() at
+the end of nilfs_mkdir()/nilfs_create()/etc to unlock the inode.
+
+If nilfs_iget() is called before nilfs_new_inode() calls
+insert_inode_locked4(), it will create an in-core inode and read its
+data from the on-disk inode.  But, nilfs_iget() will find i_nlink equals
+zero and fail at nilfs_read_inode_common(), which will lead it to call
+iget_failed() and cleanly fail.
+
+However, this sanity check doesn't work as expected for reused on-disk
+inodes because they leave a non-zero value in i_mode field and it
+hinders the test of i_nlink.  This patch also fixes the issue by
+removing the test on i_mode that nilfs2 doesn't need.
+
+Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
+Cc: Al Viro <viro@zeniv.linux.org.uk>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/nilfs2/inode.c |   32 ++++++++++++++++++++++++--------
+ fs/nilfs2/namei.c |   15 ++++++++++++---
+ 2 files changed, 36 insertions(+), 11 deletions(-)
+
+--- a/fs/nilfs2/inode.c
++++ b/fs/nilfs2/inode.c
+@@ -49,6 +49,8 @@ struct nilfs_iget_args {
+       int for_gc;
+ };
++static int nilfs_iget_test(struct inode *inode, void *opaque);
++
+ void nilfs_inode_add_blocks(struct inode *inode, int n)
+ {
+       struct nilfs_root *root = NILFS_I(inode)->i_root;
+@@ -347,6 +349,17 @@ const struct address_space_operations ni
+       .is_partially_uptodate  = block_is_partially_uptodate,
+ };
++static int nilfs_insert_inode_locked(struct inode *inode,
++                                   struct nilfs_root *root,
++                                   unsigned long ino)
++{
++      struct nilfs_iget_args args = {
++              .ino = ino, .root = root, .cno = 0, .for_gc = 0
++      };
++
++      return insert_inode_locked4(inode, ino, nilfs_iget_test, &args);
++}
++
+ struct inode *nilfs_new_inode(struct inode *dir, umode_t mode)
+ {
+       struct super_block *sb = dir->i_sb;
+@@ -382,7 +395,7 @@ struct inode *nilfs_new_inode(struct ino
+       if (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)) {
+               err = nilfs_bmap_read(ii->i_bmap, NULL);
+               if (err < 0)
+-                      goto failed_bmap;
++                      goto failed_after_creation;
+               set_bit(NILFS_I_BMAP, &ii->i_state);
+               /* No lock is needed; iget() ensures it. */
+@@ -398,21 +411,24 @@ struct inode *nilfs_new_inode(struct ino
+       spin_lock(&nilfs->ns_next_gen_lock);
+       inode->i_generation = nilfs->ns_next_generation++;
+       spin_unlock(&nilfs->ns_next_gen_lock);
+-      insert_inode_hash(inode);
++      if (nilfs_insert_inode_locked(inode, root, ino) < 0) {
++              err = -EIO;
++              goto failed_after_creation;
++      }
+       err = nilfs_init_acl(inode, dir);
+       if (unlikely(err))
+-              goto failed_acl; /* never occur. When supporting
++              goto failed_after_creation; /* never occur. When supporting
+                                   nilfs_init_acl(), proper cancellation of
+                                   above jobs should be considered */
+       return inode;
+- failed_acl:
+- failed_bmap:
++ failed_after_creation:
+       clear_nlink(inode);
++      unlock_new_inode(inode);
+       iput(inode);  /* raw_inode will be deleted through
+-                       generic_delete_inode() */
++                       nilfs_evict_inode() */
+       goto failed;
+  failed_ifile_create_inode:
+@@ -460,8 +476,8 @@ int nilfs_read_inode_common(struct inode
+       inode->i_atime.tv_nsec = le32_to_cpu(raw_inode->i_mtime_nsec);
+       inode->i_ctime.tv_nsec = le32_to_cpu(raw_inode->i_ctime_nsec);
+       inode->i_mtime.tv_nsec = le32_to_cpu(raw_inode->i_mtime_nsec);
+-      if (inode->i_nlink == 0 && inode->i_mode == 0)
+-              return -EINVAL; /* this inode is deleted */
++      if (inode->i_nlink == 0)
++              return -ESTALE; /* this inode is deleted */
+       inode->i_blocks = le64_to_cpu(raw_inode->i_blocks);
+       ii->i_flags = le32_to_cpu(raw_inode->i_flags);
+--- a/fs/nilfs2/namei.c
++++ b/fs/nilfs2/namei.c
+@@ -51,9 +51,11 @@ static inline int nilfs_add_nondir(struc
+       int err = nilfs_add_link(dentry, inode);
+       if (!err) {
+               d_instantiate(dentry, inode);
++              unlock_new_inode(inode);
+               return 0;
+       }
+       inode_dec_link_count(inode);
++      unlock_new_inode(inode);
+       iput(inode);
+       return err;
+ }
+@@ -182,6 +184,7 @@ out:
+ out_fail:
+       drop_nlink(inode);
+       nilfs_mark_inode_dirty(inode);
++      unlock_new_inode(inode);
+       iput(inode);
+       goto out;
+ }
+@@ -201,11 +204,15 @@ static int nilfs_link(struct dentry *old
+       inode_inc_link_count(inode);
+       ihold(inode);
+-      err = nilfs_add_nondir(dentry, inode);
+-      if (!err)
++      err = nilfs_add_link(dentry, inode);
++      if (!err) {
++              d_instantiate(dentry, inode);
+               err = nilfs_transaction_commit(dir->i_sb);
+-      else
++      } else {
++              inode_dec_link_count(inode);
++              iput(inode);
+               nilfs_transaction_abort(dir->i_sb);
++      }
+       return err;
+ }
+@@ -243,6 +250,7 @@ static int nilfs_mkdir(struct inode *dir
+       nilfs_mark_inode_dirty(inode);
+       d_instantiate(dentry, inode);
++      unlock_new_inode(inode);
+ out:
+       if (!err)
+               err = nilfs_transaction_commit(dir->i_sb);
+@@ -255,6 +263,7 @@ out_fail:
+       drop_nlink(inode);
+       drop_nlink(inode);
+       nilfs_mark_inode_dirty(inode);
++      unlock_new_inode(inode);
+       iput(inode);
+ out_dir:
+       drop_nlink(dir);
diff --git a/queue-3.10/scripts-kernel-doc-don-t-eat-struct-members-with-__aligned.patch b/queue-3.10/scripts-kernel-doc-don-t-eat-struct-members-with-__aligned.patch
new file mode 100644 (file)
index 0000000..dd89218
--- /dev/null
@@ -0,0 +1,53 @@
+From 7b990789a4c3420fa57596b368733158e432d444 Mon Sep 17 00:00:00 2001
+From: Johannes Berg <johannes.berg@intel.com>
+Date: Wed, 10 Dec 2014 15:41:28 -0800
+Subject: scripts/kernel-doc: don't eat struct members with __aligned
+
+From: Johannes Berg <johannes.berg@intel.com>
+
+commit 7b990789a4c3420fa57596b368733158e432d444 upstream.
+
+The change from \d+ to .+ inside __aligned() means that the following
+structure:
+
+  struct test {
+        u8 a __aligned(2);
+        u8 b __aligned(2);
+  };
+
+essentially gets modified to
+
+  struct test {
+        u8 a;
+  };
+
+for purposes of kernel-doc, thus dropping a struct member, which in
+turns causes warnings and invalid kernel-doc generation.
+
+Fix this by replacing the catch-all (".") with anything that's not a
+semicolon ("[^;]").
+
+Fixes: 9dc30918b23f ("scripts/kernel-doc: handle struct member __aligned without numbers")
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Cc: Nishanth Menon <nm@ti.com>
+Cc: Randy Dunlap <rdunlap@infradead.org>
+Cc: Michal Marek <mmarek@suse.cz>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ scripts/kernel-doc |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/scripts/kernel-doc
++++ b/scripts/kernel-doc
+@@ -1750,7 +1750,7 @@ sub dump_struct($$) {
+       # strip kmemcheck_bitfield_{begin,end}.*;
+       $members =~ s/kmemcheck_bitfield_.*?;//gos;
+       # strip attributes
+-      $members =~ s/__aligned\s*\(.+\)//gos;
++      $members =~ s/__aligned\s*\([^;]*\)//gos;
+       create_parameterlist($members, ';', $file);
+       check_sections($file, $declaration_name, "struct", $sectcheck, $struct_actual, $nested);
index a8b95e026decf70b288c149be73ebb3eccec73c9..4f4ebda8c1e6b7619c5fac284d14bad2c6ba3f9a 100644 (file)
@@ -32,3 +32,6 @@ writeback-fix-a-subtle-race-condition-in-i_dirty-clearing.patch
 serial-samsung-wait-for-transfer-completion-before-clock-disable.patch
 fs-nfsd-fix-signedness-bug-in-compare_blob.patch
 nfsd4-fix-xdr4-inclusion-of-escaped-char.patch
+nilfs2-fix-the-nilfs_iget-vs.-nilfs_new_inode-races.patch
+scripts-kernel-doc-don-t-eat-struct-members-with-__aligned.patch
+arm-mvebu-disable-i-o-coherency-on-non-smp-situations-on-armada-370-375-38x-xp.patch