Re: [PATCH 1/8] ibft scanning fails on newer kernels

2011-06-22 Thread Hannes Reinecke

On 06/21/2011 11:39 PM, Mike Christie wrote:

On 06/21/2011 04:23 AM, Hannes Reinecke wrote:

Newer kernels provide the 'net' link as a directory, instead of the
'net:XX' link with previous kernels. The sysfs scanning code has
enablement to work with this, but the directory lookup doesn't
work properly.


What is the bug exactly? What kernel does this break on? It seems to
work ok for me.

The patch seems like a enhancement and not a bug fix?? Before the patch
the code would loop through everything in the dir. If that fails then it
would drop down and look for just net. With your patch it now detects
if we are doing net:XX or net when we first fine either one.

Patch looks ok to me. Just want to make sure what is broken or not.


Hmm. Now that you mention it. Indeed it's not required anymore.
As the patch is rather old it's actually a merge artefact.
So we wouldn't be needing it.

Cheers,

Hannes
--
Dr. Hannes Reinecke   zSeries  Storage
h...@suse.de  +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)

--
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.



Re: [PATCH 1/4] BNX2I: Added the use of kthreads to handle SCSI cmd completion

2011-06-22 Thread Eddie Wai

On Tue, 2011-06-21 at 19:54 -0700, Mike Christie wrote:
 On 06/21/2011 11:49 AM, Eddie Wai wrote:
  This patch breaks the SCSI cmd completion into two parts:
  1. The bh will allocate and queued work to the cmd specific CPU IO
  completion kthread.  The CPU for the cmd is recorded in task_xmit.
  
  2. The CPU specific IO completion kthread will call the scsi_cmd_resp
  routine to do the actual cmd completion.
 
 
 I think you should use blkio poll. Modify it so it does what you want.
 But I think since other drivers are getting in without converting then
 that can wait.
Noted.  I will revisit this later then.
 
 
   struct bnx2i_cmd {
  struct iscsi_hdr hdr;
  @@ -215,6 +222,7 @@ struct bnx2i_cmd {
  struct io_bdt io_tbl;
  dma_addr_t bd_tbl_dma;
  struct bnx2i_cmd_request req;
  +   u32 cpu;
 
 
 You can just use scsi_cmnd-request-cpu
Ok, I'll make the change to use this instead of grabbing the cpu
explicitly in our driver.
 


-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.



Re: [PATCH 1/4] BNX2I: Added the use of kthreads to handle SCSI cmd completion

2011-06-22 Thread Fubo Chen
On Tue, Jun 21, 2011 at 6:49 PM, Eddie Wai eddie@broadcom.com wrote:
 +/**
 + * bnx2i_percpu_io_thread - thread per cpu for ios
 + *
 + * @arg:       ptr to bnx2i_percpu_info structure
 + */
 +int bnx2i_percpu_io_thread(void *arg)
 +{
 +       struct bnx2i_percpu_s *p = arg;
 +       struct bnx2i_work *work, *tmp;
 +       LIST_HEAD(work_list);
 +
 +       set_user_nice(current, -20);
 +
 +       set_current_state(TASK_INTERRUPTIBLE);
 +       while (!kthread_should_stop()) {
 +               schedule();
 +               spin_lock_bh(p-p_work_lock);
 +               while (!list_empty(p-work_list)) {
 +                       list_splice_init(p-work_list, work_list);
 +                       spin_unlock_bh(p-p_work_lock);
 +
 +                       list_for_each_entry_safe(work, tmp, work_list, list) 
 {
 +                               list_del_init(work-list);
 +                               /* work allocated in the bh, freed here */
 +                               bnx2i_process_scsi_cmd_resp(work-session,
 +                                                           work-bnx2i_conn,
 +                                                           work-cqe);
 +                               atomic_dec(work-bnx2i_conn-work_cnt);
 +                               kfree(work);
 +                       }
 +                       spin_lock_bh(p-p_work_lock);
 +               }
 +               set_current_state(TASK_INTERRUPTIBLE);
 +               spin_unlock_bh(p-p_work_lock);
 +       }
 +       __set_current_state(TASK_RUNNING);
 +
 +       return 0;
 +}

This loop looks a little strange to me. If the schedule() call would
be moved from the top of the outermost while loop to the bottom then
the first set_current_state(TASK_INTERRUPTIBLE) statement can be
eliminated. And that also fixes the (theoretical?) race that occurs if
wake_up_process() gets invoked after kthread_create() but before the
first set_current_state(TASK_INTERRUPTIBLE) statement got executed.

Fubo.

-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.



Re: open-iscsi-2.0-870 issue

2011-06-22 Thread Mike Christie
On 06/22/2011 03:03 AM, 王道邦 wrote:
 Hi, Mike,
  
 Any update for this? Could you duplicate it now?
  

I have not been able to replicate it. I wanted to confirm you were using
Red Hat Enterprise Linux 5 (RHEL 5), right? You did not mean Red Hat
Linux 5?

Could you try the attached patch? It will not fix the problem. It just
prints out why that getpwuid call failed.

-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.

diff --git a/usr/mgmt_ipc.c b/usr/mgmt_ipc.c
index 3e4d2ef..392484b 100644
--- a/usr/mgmt_ipc.c
+++ b/usr/mgmt_ipc.c
@@ -328,6 +328,8 @@ mgmt_peeruser(int sock, char *user)
socklen_t so_len = sizeof(peercred);
struct passwd *pass;
 
+   log_error(mgmt_peeruser trying SO_PEERCRED\n);
+
errno = 0;
if (getsockopt(sock, SOL_SOCKET, SO_PEERCRED, peercred,
so_len) != 0 || so_len != sizeof(peercred)) {
@@ -338,8 +340,8 @@ mgmt_peeruser(int sock, char *user)
 
pass = getpwuid(peercred.uid);
if (pass == NULL) {
-   log_error(peeruser_unix: unknown local user with uid %d,
-   (int) peercred.uid);
+   log_error(peeruser_unix: unknown local user with uid %d err 
%d,
+   (int) peercred.uid, errno);
return 0;
}
 
@@ -352,6 +354,8 @@ mgmt_peeruser(int sock, char *user)
 #define cruid cmcred_uid
Cred *cred;
 
+   log_error(mgmt_peeruser trying cmsgcred\n);
+
/* Compute size without padding */
/* for NetBSD */
char cmsgmem[_ALIGN(sizeof(struct cmsghdr)) + _ALIGN(sizeof(Cred))];
@@ -388,8 +392,8 @@ mgmt_peeruser(int sock, char *user)
 
pw = getpwuid(cred-cruid);
if (pw == NULL) {
-   log_error(ident_unix: unknown local user with uid %d,
-   (int) cred-cruid);
+   log_error(ident_unix: unknown local user with uid %d err %d,
+   (int) cred-cruid, errno);
return 0;
}
 
diff --git a/utils/fwparam_ibft/fwparam_ibft_sysfs.c 
b/utils/fwparam_ibft/fwparam_ibft_sysfs.c
index 9185c85..486deec 100644
--- a/utils/fwparam_ibft/fwparam_ibft_sysfs.c
+++ b/utils/fwparam_ibft/fwparam_ibft_sysfs.c
@@ -84,7 +84,7 @@ static int find_sysfs_dirs(const char *fpath, const struct 
stat *sb,
 static int get_iface_from_device(char *id, struct boot_context *context)
 {
char dev_dir[FILENAMESZ];
-   int rc = ENODEV;
+   int rc = EOPNOTSUPP;
DIR *dirfd;
struct dirent *dent;
 
@@ -99,8 +99,7 @@ static int get_iface_from_device(char *id, struct 
boot_context *context)
return errno;
 
while ((dent = readdir(dirfd))) {
-   if (!strcmp(dent-d_name, .) || !strcmp(dent-d_name, ..) ||
-   strncmp(dent-d_name, net:, 4))
+   if (!strcmp(dent-d_name, .) || !strcmp(dent-d_name, ..))
continue;
 
if (!strncmp(dent-d_name, net:, 4)) {
@@ -116,17 +115,19 @@ static int get_iface_from_device(char *id, struct 
boot_context *context)
rc = EINVAL;
rc = 0;
break;
-   } else {
-   printf(Could not read ethernet to net link.\n);
-   rc = EOPNOTSUPP;
+   }
+   if (!strcmp(dent-d_name, net)) {
+   rc = ENODEV;
break;
}
}
 
closedir(dirfd);
 
-   if (rc != ENODEV)
+   if (rc != ENODEV) {
+   printf(Could not read ethernet to net link\n.);
return rc;
+   }
 
/* If not found try again with newer kernel networkdev sysfs layout */
strlcat(dev_dir, /net, FILENAMESZ);
diff --git a/utils/fwparam_ibft/prom_lex.c b/utils/fwparam_ibft/prom_lex.c
index 704d8ca..5fdd95b 100644
--- a/utils/fwparam_ibft/prom_lex.c
+++ b/utils/fwparam_ibft/prom_lex.c
@@ -8,7 +8,7 @@
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 33
+#define YY_FLEX_SUBMINOR_VERSION 35
 #if YY_FLEX_SUBMINOR_VERSION  0
 #define FLEX_BETA
 #endif
@@ -30,7 +30,7 @@
 
 /* C99 systems have inttypes.h. Non-C99 systems may or may not. */
 
-#if __STDC_VERSION__ = 199901L
+#if defined (__STDC_VERSION__)  __STDC_VERSION__ = 199901L
 
 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
  * if you want the limit (max/min) macros for int types. 
@@ -93,11 +93,12 @@ typedef unsigned int flex_uint32_t;
 
 #else  /* ! __cplusplus */
 
-#if __STDC__
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined