return NULL;
}
+/* Returns whether any FS are still pending remounted */
+static int mark_all_pending_mounts(void)
+{
+ int unmounted = 1;
+ struct orangefs_sb_info_s *orangefs_sb = NULL;
+
+ spin_lock(&orangefs_superblocks_lock);
+ list_for_each_entry(orangefs_sb, &orangefs_superblocks, list) {
+ /* All of these file system require a remount */
+ orangefs_sb->mount_pending = 1;
+ unmounted = 0;
+ }
+ spin_unlock(&orangefs_superblocks_lock);
+ return unmounted;
+}
+
+/*
+ * Determine if a given file system needs to be remounted or not
+ * Returns -1 on error
+ * 0 if already mounted
+ * 1 if needs remount
+ */
+static int fs_mount_pending(__s32 fsid)
+{
+ int mount_pending = -1;
+ struct orangefs_sb_info_s *orangefs_sb = NULL;
+
+ spin_lock(&orangefs_superblocks_lock);
+ list_for_each_entry(orangefs_sb, &orangefs_superblocks, list) {
+ if (orangefs_sb->fs_id == fsid) {
+ mount_pending = orangefs_sb->mount_pending;
+ break;
+ }
+ }
+ spin_unlock(&orangefs_superblocks_lock);
+ return mount_pending;
+}
+
static int orangefs_devreq_open(struct inode *inode, struct file *file)
{
int ret = -EINVAL;
goto wakeup;
}
-/* Returns whether any FS are still pending remounted */
-static int mark_all_pending_mounts(void)
-{
- int unmounted = 1;
- struct orangefs_sb_info_s *orangefs_sb = NULL;
-
- spin_lock(&orangefs_superblocks_lock);
- list_for_each_entry(orangefs_sb, &orangefs_superblocks, list) {
- /* All of these file system require a remount */
- orangefs_sb->mount_pending = 1;
- unmounted = 0;
- }
- spin_unlock(&orangefs_superblocks_lock);
- return unmounted;
-}
-
-/*
- * Determine if a given file system needs to be remounted or not
- * Returns -1 on error
- * 0 if already mounted
- * 1 if needs remount
- */
-int fs_mount_pending(__s32 fsid)
-{
- int mount_pending = -1;
- struct orangefs_sb_info_s *orangefs_sb = NULL;
-
- spin_lock(&orangefs_superblocks_lock);
- list_for_each_entry(orangefs_sb, &orangefs_superblocks, list) {
- if (orangefs_sb->fs_id == fsid) {
- mount_pending = orangefs_sb->mount_pending;
- break;
- }
- }
- spin_unlock(&orangefs_superblocks_lock);
- return mount_pending;
-}
-
/*
* NOTE: gets called when the last reference to this device is dropped.
* Using the open_access_count variable, we enforce a reference count
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 */
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__);
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__);