]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 Jun 2012 21:48:04 +0000 (06:48 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 Jun 2012 21:48:04 +0000 (06:48 +0900)
added patches:
acpi-battery-only-refresh-the-sysfs-files-when-pertinent-information-changes.patch
vfs-fix-proc-tid-fdinfo-fd-file-handling.patch

queue-3.4/acpi-battery-only-refresh-the-sysfs-files-when-pertinent-information-changes.patch [new file with mode: 0644]
queue-3.4/series
queue-3.4/vfs-fix-proc-tid-fdinfo-fd-file-handling.patch [new file with mode: 0644]

diff --git a/queue-3.4/acpi-battery-only-refresh-the-sysfs-files-when-pertinent-information-changes.patch b/queue-3.4/acpi-battery-only-refresh-the-sysfs-files-when-pertinent-information-changes.patch
new file mode 100644 (file)
index 0000000..f096540
--- /dev/null
@@ -0,0 +1,48 @@
+From c5971456964290da7e98222892797b71ef793e62 Mon Sep 17 00:00:00 2001
+From: Andy Whitcroft <apw@canonical.com>
+Date: Thu, 3 May 2012 14:48:26 +0100
+Subject: ACPI battery: only refresh the sysfs files when pertinent information changes
+
+From: Andy Whitcroft <apw@canonical.com>
+
+commit c5971456964290da7e98222892797b71ef793e62 upstream.
+
+We only need to regenerate the sysfs files when the capacity units
+change, avoid the update otherwise.
+
+The origin of this issue is dates way back to 2.6.38:
+da8aeb92d4853f37e281f11fddf61f9c7d84c3cd
+(ACPI / Battery: Update information on info notification and resume)
+
+Signed-off-by: Andy Whitcroft <apw@canonical.com>
+Tested-by: Ralf Jung <post@ralfj.de>
+Signed-off-by: Len Brown <len.brown@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/acpi/battery.c |   10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+--- a/drivers/acpi/battery.c
++++ b/drivers/acpi/battery.c
+@@ -643,11 +643,19 @@ static int acpi_battery_update(struct ac
+ static void acpi_battery_refresh(struct acpi_battery *battery)
+ {
++      int power_unit;
++
+       if (!battery->bat.dev)
+               return;
++      power_unit = battery->power_unit;
++
+       acpi_battery_get_info(battery);
+-      /* The battery may have changed its reporting units. */
++
++      if (power_unit == battery->power_unit)
++              return;
++
++      /* The battery has changed its reporting units. */
+       sysfs_remove_battery(battery);
+       sysfs_add_battery(battery);
+ }
index 47eb57f7d983eff7df685bc9e857563efdee4554..2e89cea32d86b51f16be92e57c96d3b32dd035a4 100644 (file)
@@ -73,3 +73,5 @@ drm-radeon-kms-add-new-btc-pci-ids.patch
 drm-radeon-kms-add-new-si-pci-ids.patch
 iommu-amd-cache-pdev-pointer-to-root-bridge.patch
 iommu-amd-fix-deadlock-in-ppr-handling-error-path.patch
+acpi-battery-only-refresh-the-sysfs-files-when-pertinent-information-changes.patch
+vfs-fix-proc-tid-fdinfo-fd-file-handling.patch
diff --git a/queue-3.4/vfs-fix-proc-tid-fdinfo-fd-file-handling.patch b/queue-3.4/vfs-fix-proc-tid-fdinfo-fd-file-handling.patch
new file mode 100644 (file)
index 0000000..ebdff19
--- /dev/null
@@ -0,0 +1,81 @@
+From 0640113be25d283e0ff77a9f041e1242182387f0 Mon Sep 17 00:00:00 2001
+From: Linus Torvalds <torvalds@linux-foundation.org>
+Date: Mon, 4 Jun 2012 11:00:45 -0700
+Subject: vfs: Fix /proc/<tid>/fdinfo/<fd> file handling
+
+From: Linus Torvalds <torvalds@linux-foundation.org>
+
+commit 0640113be25d283e0ff77a9f041e1242182387f0 upstream.
+
+Cyrill Gorcunov reports that I broke the fdinfo files with commit
+30a08bf2d31d ("proc: move fd symlink i_mode calculations into
+tid_fd_revalidate()"), and he's quite right.
+
+The tid_fd_revalidate() function is not just used for the <tid>/fd
+symlinks, it's also used for the <tid>/fdinfo/<fd> files, and the
+permission model for those are different.
+
+So do the dynamic symlink permission handling just for symlinks, making
+the fdinfo files once more appear as the proper regular files they are.
+
+Of course, Al Viro argued (probably correctly) that we shouldn't do the
+symlink permission games at all, and make the symlinks always just be
+the normal 'lrwxrwxrwx'.  That would have avoided this issue too, but
+since somebody noticed that the permissions had changed (which was the
+reason for that original commit 30a08bf2d31d in the first place), people
+do apparently use this feature.
+
+[ Basically, you can use the symlink permission data as a cheap "fdinfo"
+  replacement, since you see whether the file is open for reading and/or
+  writing by just looking at st_mode of the symlink.  So the feature
+  does make sense, even if the pain it has caused means we probably
+  shouldn't have done it to begin with. ]
+
+Reported-and-tested-by: Cyrill Gorcunov <gorcunov@openvz.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/proc/base.c |   17 ++++++++++-------
+ 1 file changed, 10 insertions(+), 7 deletions(-)
+
+--- a/fs/proc/base.c
++++ b/fs/proc/base.c
+@@ -1803,7 +1803,7 @@ static int tid_fd_revalidate(struct dent
+                       rcu_read_lock();
+                       file = fcheck_files(files, fd);
+                       if (file) {
+-                              unsigned i_mode, f_mode = file->f_mode;
++                              unsigned f_mode = file->f_mode;
+                               rcu_read_unlock();
+                               put_files_struct(files);
+@@ -1819,12 +1819,14 @@ static int tid_fd_revalidate(struct dent
+                                       inode->i_gid = 0;
+                               }
+-                              i_mode = S_IFLNK;
+-                              if (f_mode & FMODE_READ)
+-                                      i_mode |= S_IRUSR | S_IXUSR;
+-                              if (f_mode & FMODE_WRITE)
+-                                      i_mode |= S_IWUSR | S_IXUSR;
+-                              inode->i_mode = i_mode;
++                              if (S_ISLNK(inode->i_mode)) {
++                                      unsigned i_mode = S_IFLNK;
++                                      if (f_mode & FMODE_READ)
++                                              i_mode |= S_IRUSR | S_IXUSR;
++                                      if (f_mode & FMODE_WRITE)
++                                              i_mode |= S_IWUSR | S_IXUSR;
++                                      inode->i_mode = i_mode;
++                              }
+                               security_task_to_inode(task, inode);
+                               put_task_struct(task);
+@@ -1859,6 +1861,7 @@ static struct dentry *proc_fd_instantiat
+       ei = PROC_I(inode);
+       ei->fd = fd;
++      inode->i_mode = S_IFLNK;
+       inode->i_op = &proc_pid_link_inode_operations;
+       inode->i_size = 64;
+       ei->op.proc_get_link = proc_fd_link;