Whamcloud - gitweb
LU-4015 ldiskfs: access external journal using device path 77/7777/3
authorJames Simmons <uja.ornl@gmail.com>
Tue, 5 Nov 2013 18:47:26 +0000 (13:47 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 2 Dec 2013 12:52:43 +0000 (12:52 +0000)
Currently ldiskfs when configured with an external journal
uses the device number to access it. The problem with this
approach is that the device number can change across
reboots. This patch adds a new mount option -o journal_path
to tell ldiskfs where the external journal is instead.

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: I43fff89c2bebeff4f0305cdc24cefa534fb9fe67
Reviewed-on: http://review.whamcloud.com/7777
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
ldiskfs/kernel_patches/patches/rhel6.3/ext4-journal-path-opt.patch [new file with mode: 0644]
ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.4.series
ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.series
ldiskfs/kernel_patches/series/ldiskfs-2.6-sles11.series
ldiskfs/kernel_patches/series/ldiskfs-3.0-sles11sp3.series

diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-journal-path-opt.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-journal-path-opt.patch
new file mode 100644 (file)
index 0000000..73d7839
--- /dev/null
@@ -0,0 +1,67 @@
+diff -ur linux-stage.orig/fs/ext4/super.c linux-stage/fs/ext4/super.c
+--- linux-stage.orig/fs/ext4/super.c   2013-09-26 11:25:51.970361560 -0400
++++ linux-stage/fs/ext4/super.c        2013-09-26 11:46:25.078236831 -0400
+@@ -1274,7 +1274,7 @@
+       Opt_user_xattr, Opt_nouser_xattr, Opt_acl, Opt_noacl,
+       Opt_auto_da_alloc, Opt_noauto_da_alloc, Opt_noload, Opt_nobh, Opt_bh,
+       Opt_commit, Opt_min_batch_time, Opt_max_batch_time,
+-      Opt_journal_update, Opt_journal_dev,
++      Opt_journal_update, Opt_journal_dev, Opt_journal_path,
+       Opt_journal_checksum, Opt_journal_async_commit,
+       Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback,
+       Opt_data_err_abort, Opt_data_err_ignore,
+@@ -1323,6 +1323,7 @@
+       {Opt_max_batch_time, "max_batch_time=%u"},
+       {Opt_journal_update, "journal=update"},
+       {Opt_journal_dev, "journal_dev=%u"},
++      {Opt_journal_path, "journal_path=%s"},
+       {Opt_journal_checksum, "journal_checksum"},
+       {Opt_journal_async_commit, "journal_async_commit"},
+       {Opt_abort, "abort"},
+@@ -1533,6 +1534,46 @@
+                               return 0;
+                       *journal_devnum = option;
+                       break;
++              case Opt_journal_path: {
++                      char *journal_path;
++                      struct inode *journal_inode;
++                      struct path path;
++                      int error;
++
++                      if (is_remount) {
++                              ext4_msg(sb, KERN_ERR,
++                                      "Cannot specify journal on remount");
++                              return -1;
++                      }
++                      journal_path = match_strdup(&args[0]);
++                      if (!journal_path) {
++                              ext4_msg(sb, KERN_ERR, "error: could not dup "
++                                      "journal device string");
++                              return -1;
++                      }
++
++                      error = kern_path(journal_path, LOOKUP_FOLLOW, &path);
++                      if (error) {
++                              ext4_msg(sb, KERN_ERR, "error: could not find "
++                                      "journal device path: error %d", error);
++                                      kfree(journal_path);
++                              return -1;
++                      }
++
++                      journal_inode = path.dentry->d_inode;
++                      if (!S_ISBLK(journal_inode->i_mode)) {
++                              ext4_msg(sb, KERN_ERR, "error: journal path %s "
++                                      "is not a block device", journal_path);
++                              path_put(&path);
++                              kfree(journal_path);
++                              return -1;
++                      }
++
++                      *journal_devnum = new_encode_dev(journal_inode->i_rdev);
++                      path_put(&path);
++                      kfree(journal_path);
++                      break;
++              }
+               case Opt_journal_checksum:
+                       set_opt(sbi->s_mount_opt, JOURNAL_CHECKSUM);
+                       break;
index cfa8299..f8a63af 100644 (file)
@@ -46,3 +46,4 @@ rhel6.3/ext4-fix-ext4_mb_add_n_trim.patch
 rhel6.3/ext4-max-dir-size.patch
 rhel6.4/ext4-max-dir-size-options.patch
 rhel6.3/ext4-not-discard-preallocation-umount.patch
+rhel6.3/ext4-journal-path-opt.patch
index bd2ba02..4f85148 100644 (file)
@@ -45,3 +45,4 @@ rhel6.3/ext4-fix-ext4_mb_add_n_trim.patch
 rhel6.3/ext4-max-dir-size.patch
 rhel6.3/ext4-max-dir-size-options.patch
 rhel6.3/ext4-not-discard-preallocation-umount.patch
+rhel6.3/ext4-journal-path-opt.patch
index 40bbf41..3157717 100644 (file)
@@ -45,3 +45,4 @@ rhel6.3/ext4-fix-ext4_mb_add_n_trim.patch
 rhel6.3/ext4-max-dir-size.patch
 sles11sp1/ext4-max-dir-size-options.patch
 rhel6.3/ext4-not-discard-preallocation-umount.patch
+rhel6.3/ext4-journal-path-opt.patch
index aa78cc4..e69fa59 100644 (file)
@@ -42,3 +42,4 @@ sles11sp2/ext4-pdirop.patch
 rhel6.3/ext4-max-dir-size.patch
 sles11sp2/ext4-max-dir-size-options.patch
 rhel6.3/ext4-not-discard-preallocation-umount.patch
+rhel6.3/ext4-journal-path-opt.patch