Skip to contentSkip to conversation

ocfs2:freeze-thaw: initialization and cleanup

PATCH New Wengang Wang 2 participants 7 messages Jan 9, 2010 – Jan 17, 2010 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 ocfs2:freeze-thaw: initialization and cleanup

this patch does some initialization and cleanup for freeze/thaw.

---
 fs/ocfs2/dlm/dlmapi.h  |    1 +
 fs/ocfs2/dlm/dlmlock.c |   12 ++++++++++++
 fs/ocfs2/dlmglue.c     |   24 ++++++++++++++++++++++++
 fs/ocfs2/super.c       |   21 +++++++++++++++++++++
 4 files changed, 58 insertions(+), 0 deletions(-)
fs/ocfs2/dlm/dlmapi.h +1 -0
index b5786a7..489c599 100644
@@ -217,4 +217,5 @@ void dlm_register_eviction_cb(struct dlm_ctxt *dlm,
 			      struct dlm_eviction_cb *cb);
 void dlm_unregister_eviction_cb(struct dlm_eviction_cb *cb);
 
+int dlm_freeze_lock_supported(struct dlm_ctxt *dlm);
 #endif /* DLMAPI_H */
fs/ocfs2/dlm/dlmlock.c +12 -0
index 437698e..ad15a66 100644
@@ -764,3 +764,15 @@ error:
 	return status;
 }
 EXPORT_SYMBOL_GPL(dlmlock);
+
+int dlm_freeze_lock_supported(struct dlm_ctxt *dlm)
+{
+	if (dlm->dlm_locking_proto.pv_major == 1)
+		return (dlm->dlm_locking_proto.pv_minor >= 1);
+
+	if (dlm->dlm_locking_proto.pv_major > 1)
+		return 1;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(dlm_freeze_lock_supported);
fs/ocfs2/dlmglue.c +24 -0
index 0caa69e..cf88af2 100644
@@ -115,6 +115,8 @@ static int ocfs2_check_refcount_downconvert(struct ocfs2_lock_res *lockres,
 					    int new_level);
 static int ocfs2_refcount_convert_worker(struct ocfs2_lock_res *lockres,
 					 int blocking);
+static int ocfs2_check_freeze_downconvert(struct ocfs2_lock_res *lockres,
+					  int new_level);
 
 #define mlog_meta_lvb(__level, __lockres) ocfs2_dump_meta_lvb_info(__level, __PRETTY_FUNCTION__, __LINE__, __lockres)
 
@@ -290,6 +292,11 @@ static struct ocfs2_lock_res_ops ocfs2_refcount_block_lops = {
 	.flags		= 0,
 };
 
+static struct ocfs2_lock_res_ops ocfs2_freeze_lops = {
+	.check_downconvert = ocfs2_check_freeze_downconvert,
+	.flags		= 0,
+};
+
 static inline int ocfs2_is_inode_lock(struct ocfs2_lock_res *lockres)
 {
 	return lockres->l_type == OCFS2_LOCK_TYPE_META ||
@@ -722,6 +729,15 @@ void ocfs2_refcount_lock_res_init(struct ocfs2_lock_res *lockres,
 				   &ocfs2_refcount_block_lops, osb);
 }
 
+static void ocfs2_freeze_lock_res_init(struct ocfs2_lock_res *res,
+				       struct ocfs2_super *osb)
+{
+	ocfs2_lock_res_init_once(res);
+	ocfs2_build_lock_name(OCFS2_LOCK_TYPE_FREEZE, 0, 0, res->l_name);
+	ocfs2_lock_res_init_common(osb, res, OCFS2_LOCK_TYPE_FREEZE,
+				   &ocfs2_freeze_lops, osb);
+}
+
 void ocfs2_lock_res_free(struct ocfs2_lock_res *res)
 {
 	mlog_entry_void();
@@ -3006,6 +3022,7 @@ local:
 	ocfs2_rename_lock_res_init(&osb->osb_rename_lockres, osb);
 	ocfs2_nfs_sync_lock_res_init(&osb->osb_nfs_sync_lockres, osb);
 	ocfs2_orphan_scan_lock_res_init(&osb->osb_orphan_scan.os_lockres, osb);
+	ocfs2_freeze_lock_res_init(&osb->osb_freeze_lockres, osb);
 
 	osb->cconn = conn;
 
@@ -3043,6 +3060,7 @@ void ocfs2_dlm_shutdown(struct ocfs2_super *osb,
 	ocfs2_lock_res_free(&osb->osb_rename_lockres);
 	ocfs2_lock_res_free(&osb->osb_nfs_sync_lockres);
 	ocfs2_lock_res_free(&osb->osb_orphan_scan.os_lockres);
+	ocfs2_lock_res_free(&osb->osb_freeze_lockres);
 
 	ocfs2_cluster_disconnect(osb->cconn, hangup_pending);
 	osb->cconn = NULL;
@@ -3228,6 +3246,7 @@ static void ocfs2_drop_osb_locks(struct ocfs2_super *osb)
 	ocfs2_simple_drop_lockres(osb, &osb->osb_rename_lockres);
 	ocfs2_simple_drop_lockres(osb, &osb->osb_nfs_sync_lockres);
 	ocfs2_simple_drop_lockres(osb, &osb->osb_orphan_scan.os_lockres);
+	ocfs2_simple_drop_lockres(osb, &osb->osb_freeze_lockres);
 }
 
 int ocfs2_drop_inode_locks(struct inode *inode)
@@ -3909,6 +3928,11 @@ void ocfs2_set_locking_protocol(void)
 	ocfs2_stack_glue_set_locking_protocol(&lproto);
 }
 
+static int ocfs2_check_freeze_downconvert(struct ocfs2_lock_res *lockres,
+					  int new_level)
+{
+	return 1; //change me
+}
 
 static void ocfs2_process_blocked_lock(struct ocfs2_super *osb,
 				       struct ocfs2_lock_res *lockres)
fs/ocfs2/super.c +21 -0
index 14f47d2..9127760 100644
@@ -134,6 +134,7 @@ static void ocfs2_destroy_inode(struct inode *inode);
 static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend);
 static int ocfs2_enable_quotas(struct ocfs2_super *osb);
 static void ocfs2_disable_quotas(struct ocfs2_super *osb);
+static int ocfs2_freeze_lock_supported(struct ocfs2_super *osb);
 
 static const struct super_operations ocfs2_sops = {
 	.statfs		= ocfs2_statfs,
@@ -1772,10 +1773,18 @@ static int ocfs2_get_sector(struct super_block *sb,
 	return 0;
 }
 
+static int ocfs2_freeze_lock_supported(struct ocfs2_super *osb)
+{
+	if (!osb->cconn || !osb->cconn->cc_lockspace)
+		return 0;
+	return dlm_freeze_lock_supported(osb->cconn->cc_lockspace);
+}
+
 static int ocfs2_mount_volume(struct super_block *sb)
 {
 	int status = 0;
 	int unlock_super = 0;
+	int unlock_freeze = 0;
 	struct ocfs2_super *osb = OCFS2_SB(sb);
 
 	mlog_entry_void();
@@ -1796,6 +1805,15 @@ static int ocfs2_mount_volume(struct super_block *sb)
 	}
 	unlock_super = 1;
 
+	if (ocfs2_freeze_lock_supported(osb)) {
+		status = ocfs2_freeze_lock(osb, 0);
+		if (status < 0) {
+			mlog_errno(status);
+			goto leave;
+		}
+		unlock_freeze = 1;
+	}
+
 	/* This will load up the node map and add ourselves to it. */
 	status = ocfs2_find_slot(osb);
 	if (status < 0) {
@@ -1821,6 +1839,9 @@ static int ocfs2_mount_volume(struct super_block *sb)
 		mlog_errno(status);
 
 leave:
+	if (ocfs2_freeze_lock_supported(osb) && unlock_freeze)
+		ocfs2_freeze_unlock(osb, 0);
+
 	if (unlock_super)
 		ocfs2_super_unlock(osb, 1);
 
Signature · 1 line
1.6.5.2
#1 lore raw

PATCH 2/3 ocfs2:freeze-thaw: initialization and cleanup

Quoted 3 lines · Wengang Wang

this patch does some initialization and cleanup for freeze/thaw.

Please capitalize the first letter of a sentence. ;)

Quoted 31 lines
---
 fs/ocfs2/dlm/dlmapi.h  |    1 +
 fs/ocfs2/dlm/dlmlock.c |   12 ++++++++++++
 fs/ocfs2/dlmglue.c     |   24 ++++++++++++++++++++++++
 fs/ocfs2/super.c       |   21 +++++++++++++++++++++
 4 files changed, 58 insertions(+), 0 deletions(-)
fs/ocfs2/dlm/dlmapi.h +1 -0
index b5786a7..489c599 100644
@@ -217,4 +217,5 @@ void dlm_register_eviction_cb(struct dlm_ctxt *dlm,
 			      struct dlm_eviction_cb *cb);
 void dlm_unregister_eviction_cb(struct dlm_eviction_cb *cb);
 
+int dlm_freeze_lock_supported(struct dlm_ctxt *dlm);
 #endif /* DLMAPI_H */
fs/ocfs2/dlm/dlmlock.c +2 -0
index 437698e..ad15a66 100644
@@ -764,3 +764,15 @@ error:
 	return status;
 }
 EXPORT_SYMBOL_GPL(dlmlock);
+
+int dlm_freeze_lock_supported(struct dlm_ctxt *dlm)

fs/ocfs2/dlm/dlmlock.c error: · line 778

Quoted 10 lines
fs/ocfs2/dlm/dlmlock.c +10 -0
+{
+	if (dlm->dlm_locking_proto.pv_major == 1)
+		return (dlm->dlm_locking_proto.pv_minor >= 1);
+
+	if (dlm->dlm_locking_proto.pv_major > 1)
+		return 1;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(dlm_freeze_lock_supported);

Change the fs protocol. We shouldn't need to export any symbols.

Quoted 66 lines
fs/ocfs2/dlmglue.c +19 -0
index 0caa69e..cf88af2 100644
@@ -115,6 +115,8 @@ static int ocfs2_check_refcount_downconvert(struct ocfs2_lock_res *lockres,
 					    int new_level);
 static int ocfs2_refcount_convert_worker(struct ocfs2_lock_res *lockres,
 					 int blocking);
+static int ocfs2_check_freeze_downconvert(struct ocfs2_lock_res *lockres,
+					  int new_level);
 
 #define mlog_meta_lvb(__level, __lockres) ocfs2_dump_meta_lvb_info(__level, __PRETTY_FUNCTION__, __LINE__, __lockres)
 
@@ -290,6 +292,11 @@ static struct ocfs2_lock_res_ops ocfs2_refcount_block_lops = {
 	.flags		= 0,
 };
 
+static struct ocfs2_lock_res_ops ocfs2_freeze_lops = {
+	.check_downconvert = ocfs2_check_freeze_downconvert,
+	.flags		= 0,
+};
+
 static inline int ocfs2_is_inode_lock(struct ocfs2_lock_res *lockres)
 {
 	return lockres->l_type == OCFS2_LOCK_TYPE_META ||
@@ -722,6 +729,15 @@ void ocfs2_refcount_lock_res_init(struct ocfs2_lock_res *lockres,
 				   &ocfs2_refcount_block_lops, osb);
 }
 
+static void ocfs2_freeze_lock_res_init(struct ocfs2_lock_res *res,
+				       struct ocfs2_super *osb)
+{
+	ocfs2_lock_res_init_once(res);
+	ocfs2_build_lock_name(OCFS2_LOCK_TYPE_FREEZE, 0, 0, res->l_name);
+	ocfs2_lock_res_init_common(osb, res, OCFS2_LOCK_TYPE_FREEZE,
+				   &ocfs2_freeze_lops, osb);
+}
+
 void ocfs2_lock_res_free(struct ocfs2_lock_res *res)
 {
 	mlog_entry_void();
@@ -3006,6 +3022,7 @@ local:
 	ocfs2_rename_lock_res_init(&osb->osb_rename_lockres, osb);
 	ocfs2_nfs_sync_lock_res_init(&osb->osb_nfs_sync_lockres, osb);
 	ocfs2_orphan_scan_lock_res_init(&osb->osb_orphan_scan.os_lockres, osb);
+	ocfs2_freeze_lock_res_init(&osb->osb_freeze_lockres, osb);
 
 	osb->cconn = conn;
 
@@ -3043,6 +3060,7 @@ void ocfs2_dlm_shutdown(struct ocfs2_super *osb,
 	ocfs2_lock_res_free(&osb->osb_rename_lockres);
 	ocfs2_lock_res_free(&osb->osb_nfs_sync_lockres);
 	ocfs2_lock_res_free(&osb->osb_orphan_scan.os_lockres);
+	ocfs2_lock_res_free(&osb->osb_freeze_lockres);
 
 	ocfs2_cluster_disconnect(osb->cconn, hangup_pending);
 	osb->cconn = NULL;
@@ -3228,6 +3246,7 @@ static void ocfs2_drop_osb_locks(struct ocfs2_super *osb)
 	ocfs2_simple_drop_lockres(osb, &osb->osb_rename_lockres);
 	ocfs2_simple_drop_lockres(osb, &osb->osb_nfs_sync_lockres);
 	ocfs2_simple_drop_lockres(osb, &osb->osb_orphan_scan.os_lockres);
+	ocfs2_simple_drop_lockres(osb, &osb->osb_freeze_lockres);
 }
 
 int ocfs2_drop_inode_locks(struct inode *inode)

fs/ocfs2/dlmglue.c void ocfs2_set_locking_protocol(void) · line 3936

Quoted 9 lines
fs/ocfs2/dlmglue.c +5 -0
@@ -3909,6 +3928,11 @@ void ocfs2_set_locking_protocol(void)
 	ocfs2_stack_glue_set_locking_protocol(&lproto);
 }
 
+static int ocfs2_check_freeze_downconvert(struct ocfs2_lock_res *lockres,
+					  int new_level)
+{
+	return 1; //change me
+}
 

If it's going to return 1 always, then we don't need it.

Quoted 51 lines
fs/ocfs2/dlmglue.c +0 -0
 static void ocfs2_process_blocked_lock(struct ocfs2_super *osb,
 				       struct ocfs2_lock_res *lockres)
fs/ocfs2/super.c +18 -0
index 14f47d2..9127760 100644
@@ -134,6 +134,7 @@ static void ocfs2_destroy_inode(struct inode *inode);
 static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend);
 static int ocfs2_enable_quotas(struct ocfs2_super *osb);
 static void ocfs2_disable_quotas(struct ocfs2_super *osb);
+static int ocfs2_freeze_lock_supported(struct ocfs2_super *osb);
 
 static const struct super_operations ocfs2_sops = {
 	.statfs		= ocfs2_statfs,
@@ -1772,10 +1773,18 @@ static int ocfs2_get_sector(struct super_block *sb,
 	return 0;
 }
 
+static int ocfs2_freeze_lock_supported(struct ocfs2_super *osb)
+{
+	if (!osb->cconn || !osb->cconn->cc_lockspace)
+		return 0;
+	return dlm_freeze_lock_supported(osb->cconn->cc_lockspace);
+}
+
 static int ocfs2_mount_volume(struct super_block *sb)
 {
 	int status = 0;
 	int unlock_super = 0;
+	int unlock_freeze = 0;
 	struct ocfs2_super *osb = OCFS2_SB(sb);
 
 	mlog_entry_void();
@@ -1796,6 +1805,15 @@ static int ocfs2_mount_volume(struct super_block *sb)
 	}
 	unlock_super = 1;
 
+	if (ocfs2_freeze_lock_supported(osb)) {
+		status = ocfs2_freeze_lock(osb, 0);
+		if (status < 0) {
+			mlog_errno(status);
+			goto leave;
+		}
+		unlock_freeze = 1;
+	}
+
 	/* This will load up the node map and add ourselves to it. */
 	status = ocfs2_find_slot(osb);
 	if (status < 0) {

fs/ocfs2/super.c static int ocfs2_mount_volume(struct super_block *sb) · line 1847

Quoted 9 lines
fs/ocfs2/super.c +3 -0
@@ -1821,6 +1839,9 @@ static int ocfs2_mount_volume(struct super_block *sb)
 		mlog_errno(status);
 
 leave:
+	if (ocfs2_freeze_lock_supported(osb) && unlock_freeze)
+		ocfs2_freeze_unlock(osb, 0);
+
 	if (unlock_super)
 		ocfs2_super_unlock(osb, 1);
 

What about cleanup in umount?

Quoted 2 lines
#2 lore raw

PATCH 2/3 ocfs2:freeze-thaw: initialization and cleanup

Hi Sunil,

Quoted 4 lines · Sunil Mushran
Quoted 1 line · Wengang Wang

this patch does some initialization and cleanup for freeze/thaw.

Please capitalize the first letter of a sentence. ;)

Ok. :)

Quoted 35 lines
Quoted 35 lines
---
 fs/ocfs2/dlm/dlmapi.h  |    1 +
 fs/ocfs2/dlm/dlmlock.c |   12 ++++++++++++
 fs/ocfs2/dlmglue.c     |   24 ++++++++++++++++++++++++
 fs/ocfs2/super.c       |   21 +++++++++++++++++++++
 4 files changed, 58 insertions(+), 0 deletions(-)
fs/ocfs2/dlm/dlmapi.h +0 -0
index b5786a7..489c599 100644
@@ -217,4 +217,5 @@ void dlm_register_eviction_cb(struct dlm_ctxt *dlm,
 			      struct dlm_eviction_cb *cb);
 void dlm_unregister_eviction_cb(struct dlm_eviction_cb *cb);
 +int dlm_freeze_lock_supported(struct dlm_ctxt *dlm);
 #endif /* DLMAPI_H */
fs/ocfs2/dlm/dlmlock.c +7 -0
index 437698e..ad15a66 100644
@@ -764,3 +764,15 @@ error:
 	return status;
 }
 EXPORT_SYMBOL_GPL(dlmlock);
+
+int dlm_freeze_lock_supported(struct dlm_ctxt *dlm)
+{
+	if (dlm->dlm_locking_proto.pv_major == 1)
+		return (dlm->dlm_locking_proto.pv_minor >= 1);
+
+	if (dlm->dlm_locking_proto.pv_major > 1)
Quoted 8 lines

fs/ocfs2/dlm/dlmlock.c error: · line 778

Quoted 6 lines
fs/ocfs2/dlm/dlmlock.c +5 -0
+		return 1;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(dlm_freeze_lock_supported);

Change the fs protocol. We shouldn't need to export any symbols.

yes, as you said.

Quoted 64 lines
Quoted 64 lines
fs/ocfs2/dlmglue.c +2 -0
index 0caa69e..cf88af2 100644
@@ -115,6 +115,8 @@ static int ocfs2_check_refcount_downconvert(struct ocfs2_lock_res *lockres,
 					    int new_level);
 static int ocfs2_refcount_convert_worker(struct ocfs2_lock_res *lockres,
 					 int blocking);
+static int ocfs2_check_freeze_downconvert(struct ocfs2_lock_res *lockres,
+					  int new_level);
  #define mlog_meta_lvb(__level, __lockres) 
 ocfs2_dump_meta_lvb_info(__level, __PRETTY_FUNCTION__, __LINE__, 
 __lockres)

@@ -290,6 +292,11 @@ static struct ocfs2_lock_res_ops
ocfs2_refcount_block_lops = {

fs/ocfs2/dlmglue.c +13 -0
 	.flags		= 0,
 };
 +static struct ocfs2_lock_res_ops ocfs2_freeze_lops = {
+	.check_downconvert = ocfs2_check_freeze_downconvert,
+	.flags		= 0,
+};
+
 static inline int ocfs2_is_inode_lock(struct ocfs2_lock_res *lockres)
 {
 	return lockres->l_type == OCFS2_LOCK_TYPE_META ||
@@ -722,6 +729,15 @@ void ocfs2_refcount_lock_res_init(struct ocfs2_lock_res *lockres,
 				   &ocfs2_refcount_block_lops, osb);
 }
 +static void ocfs2_freeze_lock_res_init(struct ocfs2_lock_res *res,
+				       struct ocfs2_super *osb)
+{
+	ocfs2_lock_res_init_once(res);
+	ocfs2_build_lock_name(OCFS2_LOCK_TYPE_FREEZE, 0, 0, res->l_name);
+	ocfs2_lock_res_init_common(osb, res, OCFS2_LOCK_TYPE_FREEZE,
+				   &ocfs2_freeze_lops, osb);
+}
+
 void ocfs2_lock_res_free(struct ocfs2_lock_res *res)
 {
 	mlog_entry_void();
@@ -3006,6 +3022,7 @@ local:
 	ocfs2_rename_lock_res_init(&osb->osb_rename_lockres, osb);
 	ocfs2_nfs_sync_lock_res_init(&osb->osb_nfs_sync_lockres, osb);
 	ocfs2_orphan_scan_lock_res_init(&osb->osb_orphan_scan.os_lockres, osb);
+	ocfs2_freeze_lock_res_init(&osb->osb_freeze_lockres, osb);
  	osb->cconn = conn;
 @@ -3043,6 +3060,7 @@ void ocfs2_dlm_shutdown(struct ocfs2_super *osb,
 	ocfs2_lock_res_free(&osb->osb_rename_lockres);
fs/ocfs2/dlmglue.c +2 -0
 	ocfs2_lock_res_free(&osb->osb_nfs_sync_lockres);
 	ocfs2_lock_res_free(&osb->osb_orphan_scan.os_lockres);
+	ocfs2_lock_res_free(&osb->osb_freeze_lockres);
  	ocfs2_cluster_disconnect(osb->cconn, hangup_pending);
 	osb->cconn = NULL;
@@ -3228,6 +3246,7 @@ static void ocfs2_drop_osb_locks(struct ocfs2_super *osb)
 	ocfs2_simple_drop_lockres(osb, &osb->osb_rename_lockres);
 	ocfs2_simple_drop_lockres(osb, &osb->osb_nfs_sync_lockres);
 	ocfs2_simple_drop_lockres(osb, &osb->osb_orphan_scan.os_lockres);
+	ocfs2_simple_drop_lockres(osb, &osb->osb_freeze_lockres);
 }
  int ocfs2_drop_inode_locks(struct inode *inode)
@@ -3909,6 +3928,11 @@ void ocfs2_set_locking_protocol(void)
 	ocfs2_stack_glue_set_locking_protocol(&lproto);
 }
 +static int ocfs2_check_freeze_downconvert(struct ocfs2_lock_res 
Quoted 8 lines

fs/ocfs2/dlmglue.c void ocfs2_set_locking_protocol(void) · line 3936

Quoted 6 lines
fs/ocfs2/dlmglue.c +4 -0
 *lockres,
+					  int new_level)
+{
+	return 1; //change me
+}
 

If it's going to return 1 always, then we don't need it.

yes. it's changed in patch 3.
to separate big patch into sub ones, it's so written. and until here, ocfs2_check_freeze_downconvert() shouldn't effect anything since we don't support freeze/thaw so far to the patch.

Quoted 49 lines
Quoted 49 lines
fs/ocfs2/dlmglue.c +0 -0
  static void ocfs2_process_blocked_lock(struct ocfs2_super *osb,
 				       struct ocfs2_lock_res *lockres)
fs/ocfs2/super.c +16 -0
index 14f47d2..9127760 100644
@@ -134,6 +134,7 @@ static void ocfs2_destroy_inode(struct inode *inode);
 static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend);
 static int ocfs2_enable_quotas(struct ocfs2_super *osb);
 static void ocfs2_disable_quotas(struct ocfs2_super *osb);
+static int ocfs2_freeze_lock_supported(struct ocfs2_super *osb);
  static const struct super_operations ocfs2_sops = {
 	.statfs		= ocfs2_statfs,
@@ -1772,10 +1773,18 @@ static int ocfs2_get_sector(struct super_block *sb,
 	return 0;
 }
 +static int ocfs2_freeze_lock_supported(struct ocfs2_super *osb)
+{
+	if (!osb->cconn || !osb->cconn->cc_lockspace)
+		return 0;
+	return dlm_freeze_lock_supported(osb->cconn->cc_lockspace);
+}
+
 static int ocfs2_mount_volume(struct super_block *sb)
 {
 	int status = 0;
 	int unlock_super = 0;
+	int unlock_freeze = 0;
 	struct ocfs2_super *osb = OCFS2_SB(sb);
  	mlog_entry_void();
@@ -1796,6 +1805,15 @@ static int ocfs2_mount_volume(struct super_block *sb)
 	}
 	unlock_super = 1;
 +	if (ocfs2_freeze_lock_supported(osb)) {
+		status = ocfs2_freeze_lock(osb, 0);
+		if (status < 0) {
+			mlog_errno(status);
+			goto leave;
+		}
+		unlock_freeze = 1;
+	}
+
 	/* This will load up the node map and add ourselves to it. */
 	status = ocfs2_find_slot(osb);
 	if (status < 0) {
@@ -1821,6 +1839,9 @@ static int ocfs2_mount_volume(struct super_block *sb)
 		mlog_errno(status);
  leave:
Quoted 8 lines

fs/ocfs2/super.c static int ocfs2_mount_volume(struct super_block *sb) · line 1847

Quoted 6 lines
fs/ocfs2/super.c +3 -0
+	if (ocfs2_freeze_lock_supported(osb) && unlock_freeze)
+		ocfs2_freeze_unlock(osb, 0);
+
 	if (unlock_super)
 		ocfs2_super_unlock(osb, 1);
 

What about cleanup in umount?

if you meant ocfs2_freeze_unlock() in ocfs2_umount_volume() instead of at the end of ocfs2_mount_volume(), it's NG.
if cleanup when umount, then we always have a ro_holder, freeze/thaw doesn't work.

and we dont need to clean it up in umount if we already cleanup it in mount_volume. this is because the lock/unlock is used in pairs.

regards,
wengang.

Quoted 3 lines
Quoted 2 lines
#3 lore raw

PATCH 2/3 ocfs2:freeze-thaw: initialization and cleanup

Quoted 8 lines · Wengang Wang

if you meant ocfs2_freeze_unlock() in ocfs2_umount_volume() instead of at the end of ocfs2_mount_volume(), it's NG.
if cleanup when umount, then we always have a ro_holder, freeze/thaw doesn't work.

and we dont need to clean it up in umount if we already cleanup it in mount_volume. this is because the lock/unlock is used in pairs.

What's NG?

And I am not following you. Don't we have to free all locks during umount?

#4 lore raw

PATCH 2/3 ocfs2:freeze-thaw: initialization and cleanup

Hi Sunil,

Quoted 6 lines · Sunil Mushran
Quoted 5 lines · Wengang Wang

if you meant ocfs2_freeze_unlock() in ocfs2_umount_volume() instead of at the end of ocfs2_mount_volume(), it's NG.
if cleanup when umount, then we always have a ro_holder, freeze/thaw doesn't work.

Quoted 6 lines
Quoted 3 lines

and we dont need to clean it up in umount if we already cleanup it in mount_volume. this is because the lock/unlock is used in pairs.

What's NG?

NG is not good.

Quoted 2 lines

And I am not following you. Don't we have to free all locks during umount?

we don't need to free it when we umount since we don't have that lock taken. we lock/unlock it in mount, and in the downconvert action.

regards,
wengang.

#5 lore raw

PATCH 2/3 ocfs2:freeze-thaw: initialization and cleanup

Quoted 2 lines · Wengang Wang

we don't need to free it when we umount since we don't have that lock taken. we lock/unlock it in mount, and in the downconvert action.

We do have to free the lock. And you are doing it in ocfs2_dlm_shutdown(). ;)
I was looking at the wrong place. Sorry for the confusion.

#6 lore raw

PATCH 2/3 ocfs2:freeze-thaw: initialization and cleanup

Hi Sunil,

Quoted 7 lines · Sunil Mushran
Quoted 2 lines · Wengang Wang

we don't need to free it when we umount since we don't have that lock taken. we lock/unlock it in mount, and in the downconvert action.

We do have to free the lock. And you are doing it in ocfs2_dlm_shutdown(). ;)
I was looking at the wrong place. Sorry for the confusion.

Oh, no.
I am sorry too for I had a bad understand.
by "free", you meant real "free", not unlock. and I thought you meant unlock.

regards,
wengang.