From 1dee44f30fabc8953abc4695ef1f0978af94ab9c Mon Sep 17 00:00:00 2001 From: James Simmons Date: Tue, 5 Nov 2013 13:47:26 -0500 Subject: [PATCH] LU-4015 ldiskfs: access external journal using device path 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 Change-Id: I43fff89c2bebeff4f0305cdc24cefa534fb9fe67 Reviewed-on: http://review.whamcloud.com/7777 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Bob Glossman --- .../patches/rhel6.3/ext4-journal-path-opt.patch | 67 ++++++++++++++++++++++ .../series/ldiskfs-2.6-rhel6.4.series | 1 + .../kernel_patches/series/ldiskfs-2.6-rhel6.series | 1 + .../series/ldiskfs-2.6-sles11.series | 1 + .../series/ldiskfs-3.0-sles11sp3.series | 1 + 5 files changed, 71 insertions(+) create mode 100644 ldiskfs/kernel_patches/patches/rhel6.3/ext4-journal-path-opt.patch 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 index 0000000..73d7839 --- /dev/null +++ b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-journal-path-opt.patch @@ -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; diff --git a/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.4.series b/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.4.series index 38a6203..f275e6b 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.4.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.4.series @@ -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 diff --git a/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.series b/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.series index a142b09..f36b5c5 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.series @@ -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 diff --git a/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles11.series b/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles11.series index 40bbf41..3157717 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles11.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles11.series @@ -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 diff --git a/ldiskfs/kernel_patches/series/ldiskfs-3.0-sles11sp3.series b/ldiskfs/kernel_patches/series/ldiskfs-3.0-sles11sp3.series index b4909a7..0874824 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-3.0-sles11sp3.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-3.0-sles11sp3.series @@ -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 -- 1.8.3.1