Merge branch 'drm-next-4.6' of git://people.freedesktop.org/~agd5f/linux into drm...
[deliverable/linux.git] / fs / orangefs / devorangefs-req.c
index 12ea8730aa5d9ab942f168f6b94a3df677eb4582..db170beba7974c3d5d4491df452f0d75ca15ea13 100644 (file)
@@ -572,8 +572,7 @@ static long dispatch_ioctl_command(unsigned int command, unsigned long arg)
        struct dev_mask_info_s mask_info = { 0 };
        struct dev_mask2_info_s mask2_info = { 0, 0 };
        int upstream_kmod = 1;
-       struct list_head *tmp = NULL;
-       struct orangefs_sb_info_s *orangefs_sb = NULL;
+       struct orangefs_sb_info_s *orangefs_sb;
 
        /* mtmoore: add locking here */
 
@@ -619,26 +618,32 @@ static long dispatch_ioctl_command(unsigned int command, unsigned long arg)
                gossip_debug(GOSSIP_DEV_DEBUG,
                             "%s: priority remount in progress\n",
                             __func__);
-               list_for_each(tmp, &orangefs_superblocks) {
-                       orangefs_sb =
-                               list_entry(tmp,
-                                          struct orangefs_sb_info_s,
-                                          list);
-                       if (orangefs_sb && (orangefs_sb->sb)) {
+               spin_lock(&orangefs_superblocks_lock);
+               list_for_each_entry(orangefs_sb, &orangefs_superblocks, list) {
+                       /*
+                        * We have to drop the spinlock, so entries can be
+                        * removed.  They can't be freed, though, so we just
+                        * keep the forward pointers and zero the back ones -
+                        * that way we can get to the rest of the list.
+                        */
+                       if (!orangefs_sb->list.prev)
+                               continue;
+                       gossip_debug(GOSSIP_DEV_DEBUG,
+                                    "%s: Remounting SB %p\n",
+                                    __func__,
+                                    orangefs_sb);
+
+                       spin_unlock(&orangefs_superblocks_lock);
+                       ret = orangefs_remount(orangefs_sb);
+                       spin_lock(&orangefs_superblocks_lock);
+                       if (ret) {
                                gossip_debug(GOSSIP_DEV_DEBUG,
-                                            "%s: Remounting SB %p\n",
-                                            __func__,
+                                            "SB %p remount failed\n",
                                             orangefs_sb);
-
-                               ret = orangefs_remount(orangefs_sb->sb);
-                               if (ret) {
-                                       gossip_debug(GOSSIP_DEV_DEBUG,
-                                                    "SB %p remount failed\n",
-                                                    orangefs_sb);
-                                       break;
-                               }
+                               break;
                        }
                }
+               spin_unlock(&orangefs_superblocks_lock);
                gossip_debug(GOSSIP_DEV_DEBUG,
                             "%s: priority remount complete\n",
                             __func__);
@@ -678,6 +683,19 @@ static long dispatch_ioctl_command(unsigned int command, unsigned long arg)
                ret = copy_from_user(&client_debug_array_string,
                                     (void __user *)arg,
                                     ORANGEFS_MAX_DEBUG_STRING_LEN);
+               /*
+                * The real client-core makes an effort to ensure
+                * that actual strings that aren't too long to fit in
+                * this buffer is what we get here. We're going to use
+                * string functions on the stuff we got, so we'll make
+                * this extra effort to try and keep from
+                * flowing out of this buffer when we use the string
+                * functions, even if somehow the stuff we end up
+                * with here is garbage.
+                */
+               client_debug_array_string[ORANGEFS_MAX_DEBUG_STRING_LEN - 1] =
+                       '\0';
+               
                if (ret != 0) {
                        pr_info("%s: CLIENT_STRING: copy_from_user failed\n",
                                __func__);
This page took 0.024484 seconds and 5 git commands to generate.