RE: Why LUN0?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



By "like today the dummy-LUN0 will automatically be replaced" you mean with your patch - right?

My --force code was very simple - basically a 2 line change. The other changes are just prints. Here's what I did.

================================================================================
diff -Naurp old/usr/mgmt.c new/usr/mgmt.c
--- old/usr/mgmt.c	2012-10-30 21:49:30.000000000 -0400
+++ new/usr/mgmt.c	2012-11-28 19:18:51.000000000 -0500
@@ -247,7 +247,7 @@ static tgtadm_err device_mgmt(int lld_no
 					    params, 1);
 		break;
 	case OP_DELETE:
-		adm_err = tgt_device_destroy(req->tid, req->lun, 0);
+		adm_err = tgt_device_destroy(req->tid, req->lun, req->op);
 		break;
 	case OP_UPDATE:
 		adm_err = tgt_device_update(req->tid, req->lun, params);
@@ -777,7 +777,7 @@ int ipc_init(void)
 
 	err = bind(fd, (struct sockaddr *) &addr, sizeof(addr));
 	if (err) {
-		eprintf("can't bind a socket, %m\n");
+		eprintf("can't bind to socket \"%s\", %m\n", mgmt_path);
 		goto out;
 	}
 
diff -Naurp old/usr/target.c new/usr/target.c
--- old/usr/target.c	2012-10-30 21:49:30.000000000 -0400
+++ new/usr/target.c	2012-11-28 19:09:42.000000000 -0500
@@ -702,7 +702,7 @@ tgtadm_err tgt_device_destroy(int tid, u
 	struct registration *reg, *reg_next;
 	int ret;
 
-	dprintf("%u %" PRIu64 "\n", tid, lun);
+	dprintf("%u %" PRIu64 "%s\n", tid, lun, force ? " Forced" : "");
 
 	/* lun0 is special */
 	if (!lun && !force)
diff -Naurp old/usr/tgtadm.c new/usr/tgtadm.c
--- old/usr/tgtadm.c	2012-10-30 21:49:30.000000000 -0400
+++ new/usr/tgtadm.c	2012-11-28 19:06:06.000000000 -0500
@@ -818,7 +818,7 @@ int main(int argc, char **argv)
 			break;
 		case OP_DELETE:
 		case OP_STATS:
-			rc = verify_mode_params(argc, argv, "LmotlC");
+			rc = verify_mode_params(argc, argv, "LmotlCF");
 			if (rc) {
 				eprintf("target mode: option '-%c' is not "
 					  "allowed/supported\n", rc);

-----Original Message-----
From: Boaz Harrosh [mailto:bharrosh@xxxxxxxxxxx] 
Sent: Monday, December 10, 2012 11:37 AM
To: Braun, David
Cc: ronnie sahlberg; stgt@xxxxxxxxxxxxxxx
Subject: Re: Why LUN0?

On 12/10/2012 06:28 PM, Braun, David wrote:
> That sounds workable.
> 
> What about when the last LUN is deleted? Would you shut down the sockets and disappear?
> 

Yes sure, same thing that is done today on "tgtadm remove target" should be promoted to remove of last LUN.

> And like you - my --force fix works for me! But that's not the way to do it.
> 

Actually it is not that bad in my opinion. I have not seen the actual code but for me it kind of makes sense too. Unless code wise it's ugly, I couldn't tell.

What if you don't do a --force option at all. What if like today the dummy-LUN0 will automatically be replaced by the first real LUN0 set by tgtadm? that sounds even better but same as your solution.

Will you have a bit of time to work on this. Please CC me I'll review and test your code.

> What would the "correct" way be?
> 

either way for me apply, I think. It's your call.

Thanks
Boaz

��.n��������+%������w��{.n�������{ay�ʇڙ���f���h������_�(�階�ݢj"��������G����?���&��



[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux