Skip to contentSkip to conversation

Source code of SMB2 Kernel module

DISCUSSION Shinnosuke Yagi 3 participants 17 messages Oct 26, 2010 – Nov 12, 2010 15 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Dear.

Now, I try to use mount.smb2, which was posted at
http://archives.free.net.ph/message/20100507.172615.fda263bc.en.html

However, mount.smb2 was failed with error message.

mount error: smb2 filesystem not supported by the system

So, I need a source code of smb2 kernel module. (Test or experimental branch will do, because I know smb2
is not in mainline kernels.)

I tried to do
"git clone
http://www.kernel.org/home/ftp/pub/scm/linux/kernel/git/sfrench/smb2.git"
to find it failed.

Are there another git repository (or any patch) ?

Thanks.

Signature · 2 lines
-------------------------------------
Shinnosuke Yagi

A message that is not in the archive (sent off-list or not yet received): 4CC65859.7040100-o7dWnD6vFTHqq2nvvmkE/[email protected]

#2 lore raw
Quoted 13 lines · Shinnosuke Yagi

Dear.

Now, I try to use mount.smb2, which was posted at
http://archives.free.net.ph/message/20100507.172615.fda263bc.en.html

However, mount.smb2 was failed with error message.

mount error: smb2 filesystem not supported by the system

So, I need a source code of smb2 kernel module. (Test or experimental branch will do, because I know smb2
is not in mainline kernels.)

Quoted 7 lines

I tried to do
"git clone
http://www.kernel.org/home/ftp/pub/scm/linux/kernel/git/sfrench/smb2.git"
to find it failed.

Are there another git repository (or any patch) ?

Try doing:

git clone git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/smb2.git

Signature · 1 line
Suresh Jayaraman

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Thank you, Suresh.

I could get kernel source.
Then, I try to build with following SMB2 options.

==========================================

$ grep SMB2 .config
CONFIG_SMB2_FS=y
# CONFIG_SMB2_STATS is not set
# CONFIG_SMB2_DEBUG2 is not set
==========================================

However, I failed to build and got a following error.

====================================================

$ make
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  VDSOSYM arch/x86/vdso/vdso32-int80-syms.lds
  VDSOSYM arch/x86/vdso/vdso32-sysenter-syms.lds
  VDSOSYM arch/x86/vdso/vdso32-syms.lds
  LD      arch/x86/vdso/built-in.o
  LD      arch/x86/built-in.o
  LD      fs/built-in.o
ld: fs/cifs_common/built-in.o: No such file: No such file or directory
make[1]: *** [fs/built-in.o] Error 1
make: *** [fs] Error 2
=====================================================

It seems that files in fs/cifs_common/ are lost.

In fact, fs/cifs_common is empty.

================================================================

$ ls -al fs/cifs_common/
合計 16
drwxr-xr-x  2 xxxx xxxx  4096 2010-10-29 15:33 .
drwxr-xr-x 74 xxxx xxxx 12288 2010-10-29 15:42 ..
-rw-r--r--  1 xxxx xxxx     0 2010-10-27 11:00 Makefile
-rw-r--r--  1 xxxx xxxx     0 2010-10-29 15:42 modules.order
================================================================

I also failed to bulid with no SMB2 options.

What should I do?

Thanks.

Quoted 27 lines · Suresh Jayaraman
Quoted 13 lines · Shinnosuke Yagi

Dear.

Now, I try to use mount.smb2, which was posted at
http://archives.free.net.ph/message/20100507.172615.fda263bc.en.html

However, mount.smb2 was failed with error message.

mount error: smb2 filesystem not supported by the system

So, I need a source code of smb2 kernel module. (Test or experimental branch will do, because I know smb2
is not in mainline kernels.)

Quoted 7 lines

I tried to do
"git clone
http://www.kernel.org/home/ftp/pub/scm/linux/kernel/git/sfrench/smb2.git"
to find it failed.

Are there another git repository (or any patch) ?

Try doing:

git clone git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/smb2.git

Signature · 6 lines
-------------------------------------
八木 清之介 (ヤギ シンノスケ)
NTTコムウェア株式会社
ネットワーク・ソリューション事業本部
yagi.shinnosuke-o7dWnD6vFTHqq2nvvmkE/[email protected]
-------------------------------------

A message that is not in the archive (sent off-list or not yet received): 4CCA6FD3.4060907-o7dWnD6vFTHqq2nvvmkE/[email protected]

#6 lore raw
Quoted 16 lines · Shinnosuke Yagi

Thank you, Suresh.

I could get kernel source.
Then, I try to build with following SMB2 options.

==========================================

$ grep SMB2 .config
CONFIG_SMB2_FS=y
# CONFIG_SMB2_STATS is not set
# CONFIG_SMB2_DEBUG2 is not set
==========================================

However, I failed to build and got a following error.

====================================================

Quoted 16 lines
$ make
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  VDSOSYM arch/x86/vdso/vdso32-int80-syms.lds
  VDSOSYM arch/x86/vdso/vdso32-sysenter-syms.lds
  VDSOSYM arch/x86/vdso/vdso32-syms.lds
  LD      arch/x86/vdso/built-in.o
  LD      arch/x86/built-in.o
  LD      fs/built-in.o
ld: fs/cifs_common/built-in.o: No such file: No such file or directory
make[1]: *** [fs/built-in.o] Error 1
make: *** [fs] Error 2
=====================================================

Just comment out the line

obj-$(CONFIG_CIFS_COMMON) += cifs_common/

in fs/Makefile and try. Seems Steve's fix is still missing in the smb2.git.

Signature · 1 line
Suresh Jayaraman

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw

Thank you, Suresh.

I succeeded in building kernel and mount SAMBA share with mount.smb2.

However, it seems that mount.smb2 works as cifs client (NOT works as SMB2 client).

Mount.smb2 doesn't offer to use SMB2 in it's SMB Negotiation Request. (Payload is the same as that of mount.cifs .)

From Windows Vista client, SMB2 works well, so server setting is valid.

Are there any mandatory settings (such as environment variables)
to run mount.smb2 as SMB2 client?

"cifs" is displayed in File system type field of mount output.
===================================================================

 # mount.smb2 //server/share /mnt/smb2/ -o user=xxxx,pass=yyyy
 # mount
 ...
 //server/share on /mnt/smb2 type cifs (rw,mand)
===================================================================

Packet dump of SMB Negotioation packet of mount.smb2 is follow.
========================================================================
IP6 Client.57486 > Server.445: Flags [P.], seq 1:83, ack 1, win 90, options [nop,nop,TS val 5376161 ecr 758578309], length 82SMB PACKET: SMBnegprot (REQUEST)

 0x0000:  6000 0000 0072 0640 2002 0192 0168 0001  `[email protected]..
 0x0010:  f6ce 46ff fe31 e4ca 2002 0192 0168 0001  ..F..1.......h..
 0x0020:  1aa9 05ff fec0 4fd1 e08e 01bd 2987 d46a  ......O.....)..j
 0x0030:  5e7d 0568 8018 005a d677 0000 0101 080a  ^}.h...Z.w......
 0x0040:  0052 08a1 2d36 fc85 0000 004e ff53 4d42  .R..-6.....N.SMB
 0x0050:  7200 0000 0000 01c0 0000 0000 0000 0000  r...............
 0x0060:  0000 0000 0000 6d5b 0000 0100 002b 0002  ......m[.....+..
 0x0070:  4c4d 312e 3258 3030 3200 024c 414e 4d41  LM1.2X002..LANMA
 0x0080:  4e32 2e31 0002 4e54 204c 4d20 302e 3132  N2.1..NT.LM.0.12
 0x0090:  0002 504f 5349 5820 3200                 ..POSIX.2.

========================================================================

Thanks.

Quoted 8 lines · Suresh Jayaraman

Just comment out the line

obj-$(CONFIG_CIFS_COMMON) += cifs_common/

in fs/Makefile and try. Seems Steve's fix is still missing in the smb2.git.

Signature · 6 lines
-------------------------------------
八木 清之介 (ヤギ シンノスケ)
NTTコムウェア株式会社
ネットワーク・ソリューション事業本部
yagi.shinnosuke-o7dWnD6vFTHqq2nvvmkE/[email protected]
-------------------------------------

A message that is not in the archive (sent off-list or not yet received): 4CCF5DF8.9030809-o7dWnD6vFTHqq2nvvmkE/[email protected]

#10 lore raw
Quoted 18 lines · Shinnosuke Yagi

Thank you, Suresh.

I succeeded in building kernel and mount SAMBA share with mount.smb2.

However, it seems that mount.smb2 works as cifs client (NOT works as SMB2 client).

Mount.smb2 doesn't offer to use SMB2 in it's SMB Negotiation Request. (Payload is the same as that of mount.cifs .)

From Windows Vista client, SMB2 works well, so server setting is valid.

Are there any mandatory settings (such as environment variables)
to run mount.smb2 as SMB2 client?

Quoted 8 lines

"cifs" is displayed in File system type field of mount output.
===================================================================

 # mount.smb2 //server/share /mnt/smb2/ -o user=xxxx,pass=yyyy
 # mount
 ...
 //server/share on /mnt/smb2 type cifs (rw,mand)
===================================================================

I'm assuming you are using the recent cifs-utils package which supports smb2.

Quoted 1 line

From where did you get mount.smb2? Is it a symlink to mount.cifs by any

chance?

Could you try

mount -t smb2 //server/share /mnt/point -o user=user1

--
Suresh Jayaraman

A message that is not in the archive (sent off-list or not yet received): [email protected]

#12 lore raw

Thank you, Suresh.

Quoted 2 lines

I'm assuming you are using the recent cifs-utils package which supports smb2.

Sorry, I didn't use newest one.
So, I updated cifs-util to version 4.7

===================================================

# mount.cifs -V
mount.cifs version: 4.7
# mount.smb2 -V
mount.cifs version: 4.7
===================================================
Quoted 1 line

From where did you get mount.smb2? Is it a symlink to mount.cifs by any chance?

Yes, it is. I made symbolic link to mount.cifs manually.

===================================================

# ls -l /sbin/mount.smb2
lrwxrwxrwx 1 root root 10 2010-10-18 10:23 /sbin/mount.smb2 -> mount.cifs*
===================================================
Quoted 3 lines

Could you try

mount -t smb2 //server/share /mnt/point -o user=user1

I tried and got another error.
Error massage is follow.
===================================================

# mount -t smb2 //server/share /mnt/point -o user=xxxx,pass=yyyy
mount error: smb2 filesystem not supported by the system
mount error(19): No such device
Refer to the mount.smb2(8) manual page (e.g. man mount.smb2)
===================================================

I didn't got this message before I updated to cifs-util 4.7

I think this means that Kernel of my box is not support SMB2, is it right?

I built my kernel from git.kernel.org/pub/scm/linux/kernel/git/sfrench/smb2.git

Kernel parametrs about SMB2 are
===================================================

# grep SMB2 .config
CONFIG_SMB2_FS=y
CONFIG_SMB2_STATS=y
CONFIG_SMB2_STATS2=y
CONFIG_SMB2_DEBUG2=y
===================================================

Should I set any other parameters ?

Thanks.

Signature · 1 line
Shinnosuke Yagi

A message that is not in the archive (sent off-list or not yet received): 4CD35A27.4050605-o7dWnD6vFTHqq2nvvmkE/[email protected]

#14 lore raw
Quoted 50 lines · Shinnosuke Yagi

Thank you, Suresh.

Quoted 2 lines

I'm assuming you are using the recent cifs-utils package which supports smb2.

Sorry, I didn't use newest one.
So, I updated cifs-util to version 4.7

===================================================

# mount.cifs -V
mount.cifs version: 4.7
# mount.smb2 -V
mount.cifs version: 4.7
===================================================
Quoted 2 lines

From where did you get mount.smb2? Is it a symlink to mount.cifs by any chance?

Yes, it is. I made symbolic link to mount.cifs manually.

===================================================

# ls -l /sbin/mount.smb2
lrwxrwxrwx 1 root root 10 2010-10-18 10:23 /sbin/mount.smb2 -> mount.cifs*
===================================================
Quoted 3 lines

Could you try

mount -t smb2 //server/share /mnt/point -o user=user1

I tried and got another error.
Error massage is follow.
===================================================

# mount -t smb2 //server/share /mnt/point -o user=xxxx,pass=yyyy
mount error: smb2 filesystem not supported by the system
mount error(19): No such device
Refer to the mount.smb2(8) manual page (e.g. man mount.smb2)
===================================================

I didn't got this message before I updated to cifs-util 4.7

I think this means that Kernel of my box is not support SMB2, is it right?

I built my kernel from git.kernel.org/pub/scm/linux/kernel/git/sfrench/smb2.git

Kernel parametrs about SMB2 are
===================================================

Quoted 8 lines
# grep SMB2 .config
CONFIG_SMB2_FS=y
CONFIG_SMB2_STATS=y
CONFIG_SMB2_STATS2=y
CONFIG_SMB2_DEBUG2=y
===================================================

Should I set any other parameters ?

try a modprobe smb2 or insmod smb2.ko

Signature · 3 lines
Thanks,

Steve

A message that is not in the archive (sent off-list or not yet received): AANLkTinm718oZX2Qc4++W_CYkv0+RZRwr09Uzu4zcDn0-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#16 lore raw
Quoted 4 lines

try a modprobe smb2 or insmod smb2.ko

I tried, but nothing changed.

=================================================================

# modprobe -v smb2
insmod /lib/modules/2.6.36-rc4+/kernel/fs/smb2/smb2.ko
# mount -t smb2 //server/share /mnt/point -o user=xxxx
Password:
mount error: smb2 filesystem not supported by the system
mount error(19): No such device
Refer to the mount.smb2(8) manual page (e.g. man mount.smb2)
typescript (END)
=================================================================

I got the same result when I tried with kernel bulit-in parameters ( CONFIG_SMB2_FS=y ).

Do I have to install other modules?

Kernel and cifs-util versions are follow.
=================================================================

$ uname -a
Linux hostname 2.6.36-rc4+ #5 SMP Fri Nov 5 11:25:48 JST 2010 i686 GNU/Linux
# mount.smb2 -V
mount.cifs version: 4.7
# grep -i smb2 /boot/config-2.6.36-rc4+
CONFIG_SMB2_FS=m
CONFIG_SMB2_STATS=y
CONFIG_SMB2_STATS2=y
CONFIG_SMB2_DEBUG2=y
=================================================================

----
Yagi Shinnosuke

A message that is not in the archive (sent off-list or not yet received): 4CD76751.8010700-o7dWnD6vFTHqq2nvvmkE/[email protected]

#18 lore raw
Quoted 18 lines · Shinnosuke Yagi
Quoted 4 lines

try a modprobe smb2 or insmod smb2.ko

I tried, but nothing changed.

=================================================================

# modprobe -v smb2
insmod /lib/modules/2.6.36-rc4+/kernel/fs/smb2/smb2.ko
# mount -t smb2 //server/share /mnt/point -o user=xxxx
Password:
mount error: smb2 filesystem not supported by the system
mount error(19): No such device
Refer to the mount.smb2(8) manual page (e.g. man mount.smb2)
typescript (END)
=================================================================
Quoted 4 lines

I got the same result when I tried with kernel bulit-in parameters ( CONFIG_SMB2_FS=y ).

Do I have to install other modules?

Yes - you need fscache, I turned the equivalent of Suresh's cifs fscache (for smb2) on by default.

"modprobe fscache"

Signature · 3 lines
Thanks,

Steve

A message that is not in the archive (sent off-list or not yet received): AANLkTimx3ukvAjmuf5KQ3dSLVhpaF51pXcOfS1E_iFhY-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#20 lore raw
Quoted 23 lines · Steve French
Quoted 21 lines · Shinnosuke Yagi
Quoted 4 lines

try a modprobe smb2 or insmod smb2.ko

I tried, but nothing changed.

=================================================================

# modprobe -v smb2
insmod /lib/modules/2.6.36-rc4+/kernel/fs/smb2/smb2.ko
# mount -t smb2 //server/share /mnt/point -o user=xxxx
Password:
mount error: smb2 filesystem not supported by the system
mount error(19): No such device
Refer to the mount.smb2(8) manual page (e.g. man mount.smb2)
typescript (END)
=================================================================

I got the same result when I tried with kernel bulit-in parameters ( CONFIG_SMB2_FS=y ).

Quoted 7 lines
Quoted 1 line

Do I have to install other modules?

Yes - you need fscache, I turned the equivalent of Suresh's cifs fscache (for smb2) on by default.

"modprobe fscache"

I guess absence of fscache would result in a different error than this (perhaps invalid module format or something) and you won't be able to successfully load smb2 module itself..

But, you could verify whether the smb2 module is loaded successfully by doing
lsmod | grep smb2

Also check dmesg output for possible errors..

Signature · 1 line
Suresh Jayaraman

A message that is not in the archive (sent off-list or not yet received): [email protected]

#22 lore raw

Thank you, Suresh and Steve.

Fscache was loaded, but smb2 module was not loaded successfully. Nothing was displayed when I did

Quoted 1 line

lsmod | grep smb2

From Dmesg, following messages were displayed.
====================================================
FS-Cache: Netfs 'smb2' registered for caching
FS-Cache: Netfs 'smb2' unregistered from caching
====================================================

Does this means FS-Cache on this kernel doesn't support smb2?

Quoted 13 lines

I guess absence of fscache would result in a different error than this (perhaps invalid module format or something) and you won't be able to successfully load smb2 module itself..

But, you could verify whether the smb2 module is loaded successfully by doing
lsmod | grep smb2

Also check dmesg output for possible errors..

A message that is not in the archive (sent off-list or not yet received): 4CD8C4E6.5080603-o7dWnD6vFTHqq2nvvmkE/[email protected]

#24 lore raw
Quoted 8 lines · Shinnosuke Yagi

Thank you, Suresh and Steve.

Fscache was loaded, but smb2 module was not loaded successfully. Nothing was displayed when I did

Quoted 2 lines

  lsmod | grep smb2

Quoted 7 lines

From Dmesg, following messages were displayed.
====================================================
FS-Cache: Netfs 'smb2' registered for caching
FS-Cache: Netfs 'smb2' unregistered from caching
====================================================

Does this means FS-Cache on this kernel doesn't support smb2?

That is probably not the problem. Seems like init_smb2 is failing.
Perhaps a problem registering the required key types.

You could enable debug messages to see if additional info is logged to dmesg

e.g.

stevef@stevef-laptop:~/smb2$ git diff -a
fs/smb2/smb2fs.c +1 -1
index aa550a3..8cc1245 100644
@@ -57,7 +57,7 @@ static struct quotactl_ops smb2_quotactl_ops;
 
 /* Definitions of various global variables follow */
 
-int smb2FYI;
+int smb2FYI = 1;
 int smb2ERROR = 1;
 int trace_SMB2;
 

Alternatively you could add some logging (e.g. printk statements) to the error goto statements in this section of smb2fs.c (smb2_init)

        rc = smb2_fscache_register();
        if (rc)
                goto out_clean_proc;

        rc = smb2_init_inodecache();
        if (rc)
                goto out_unregister_fsc;

        rc = smb2_init_mids();
        if (rc)
                goto out_destroy_inodecache;

        rc = smb2_init_request_bufs();
        if (rc)
                goto out_destroy_mids;

        rc = register_filesystem(&smb2_fs_type);
        if (rc)
                goto out_destroy_request_bufs;

        rc = register_key_type(&smb2_spnego_key_type);
Signature · 1 line
Thanks,
#25 lore raw

I added some logging messages.

====================================================

# git diff fs/smb2/smb2fs.c
fs/smb2/smb2fs.c +8 -3
index aa550a3..52c9f35 100644
@@ -57,7 +57,7 @@ static struct quotactl_ops smb2_quotactl_ops;
 
 /* Definitions of various global variables follow */
 
-int smb2FYI;
+int smb2FYI = 1;
 int smb2ERROR = 1;
 int trace_SMB2;
 
@@ -1059,14 +1059,19 @@ init_smb2(void)
                goto out_destroy_inodecache;
 
        rc = smb2_init_request_bufs();
-       if (rc)
+           sFYI(1, "smb2_init_request_bufs %d", rc);
+       if (rc){
                goto out_destroy_mids;
+    }
 
        rc = register_filesystem(&smb2_fs_type);
-       if (rc)
+           sFYI(1, "register_filesystem %d", rc);
+       if (rc){
                goto out_destroy_request_bufs;
+    }
 
        rc = register_key_type(&smb2_spnego_key_type);
+           sFYI(1, "register_key_type %d", rc);
        if (rc)
                goto out_unregister_filesystem;
 

====================================================

I got following logs on dmesg.
====================================================
FS-Cache: Netfs 'smb2' registered for caching
fs/smb2/smb2fs.c: SMB2_max_buf_size 0x4000
fs/smb2/smb2fs.c: smb2_init_request_bufs 0
fs/smb2/smb2fs.c: register_filesystem 0
fs/smb2/smb2fs.c: register_key_type -17
FS-Cache: Netfs 'smb2' unregistered from caching
====================================================

register_key_types returned -17 (EEXIST)

key "smb2" has already registered?

What should I do?

Quoted 58 lines · Steve French
Quoted 8 lines · Shinnosuke Yagi

Thank you, Suresh and Steve.

Fscache was loaded, but smb2 module was not loaded successfully. Nothing was displayed when I did

Quoted 2 lines

lsmod | grep smb2

Quoted 7 lines

From Dmesg, following messages were displayed.
====================================================
FS-Cache: Netfs 'smb2' registered for caching
FS-Cache: Netfs 'smb2' unregistered from caching
====================================================

Does this means FS-Cache on this kernel doesn't support smb2?

That is probably not the problem. Seems like init_smb2 is failing.
Perhaps a problem registering the required key types.

You could enable debug messages to see if additional info is logged to dmesg

e.g.

stevef@stevef-laptop:~/smb2$ git diff -a
fs/smb2/smb2fs.c +1 -1
index aa550a3..8cc1245 100644
@@ -57,7 +57,7 @@ static struct quotactl_ops smb2_quotactl_ops;
 
  /* Definitions of various global variables follow */
 
-int smb2FYI;
+int smb2FYI = 1;
  int smb2ERROR = 1;
  int trace_SMB2;
 

Alternatively you could add some logging (e.g. printk statements) to the error goto statements in this section of smb2fs.c (smb2_init)

         rc = smb2_fscache_register();
         if (rc)
                 goto out_clean_proc;

         rc = smb2_init_inodecache();
         if (rc)
                 goto out_unregister_fsc;

         rc = smb2_init_mids();
         if (rc)
                 goto out_destroy_inodecache;

         rc = smb2_init_request_bufs();
Quoted 11 lines
         if (rc)
                 goto out_destroy_mids;

         rc = register_filesystem(&smb2_fs_type);
         if (rc)
                 goto out_destroy_request_bufs;

         rc = register_key_type(&smb2_spnego_key_type);

---------

A message that is not in the archive (sent off-list or not yet received): 4CDA4E5C.90004-o7dWnD6vFTHqq2nvvmkE/[email protected]

#27 lore raw
Quoted 17 lines · Shinnosuke Yagi

I added some logging messages.

# git diff fs/smb2/smb2fs.c
fs/smb2/smb2fs.c +1 -1
index aa550a3..52c9f35 100644
@@ -57,7 +57,7 @@ static struct quotactl_ops smb2_quotactl_ops;
 
 /* Definitions of various global variables follow */
 
-int smb2FYI;
+int smb2FYI = 1;
 int smb2ERROR = 1;
 int trace_SMB2;
 
Quoted 7 lines

I got following logs on dmesg.
====================================================
FS-Cache: Netfs 'smb2' registered for caching
fs/smb2/smb2fs.c: SMB2_max_buf_size 0x4000
fs/smb2/smb2fs.c: smb2_init_request_bufs 0
fs/smb2/smb2fs.c: register_filesystem 0
fs/smb2/smb2fs.c: register_key_type -17

-17 is -EEXIST which means ket type with the name is already present. The below patch should fix the problem I think. Could you try and report back?

From: Suresh Jayaraman <[email protected]>
Subject: [PATCH] smb2: rename smb2 spnego key type

.. to avoid key registration failure. register_key_type() doesn't allow key types with same names.

---
 fs/smb2/smb2_spnego.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/smb2/smb2_spnego.c +1 -1
index 6551002..24df95a 100644
@@ -61,7 +61,7 @@ smb2_spnego_key_destroy(struct key *key)
  * keytype for SMB2 spnego keys
  */
 struct key_type smb2_spnego_key_type = {
-	.name		= "cifs.spnego",
+	.name		= "smb2.spnego",
 	.instantiate	= smb2_spnego_key_instantiate,
 	.match		= user_match,
 	.destroy	= smb2_spnego_key_destroy,

A message that is not in the archive (sent off-list or not yet received): [email protected]

#29 lore raw

I patched and tried to mount again.

I mount successfully by smb2.
However, Kernel clashed when I accessed to mounted FS.

I couldn't got any logs, because I did not set kdump.

I will try to get a clashed kernel dump.

Please wait.

Thanks.

Quoted 64 lines · Suresh Jayaraman
Quoted 17 lines · Shinnosuke Yagi

I added some logging messages.

# git diff fs/smb2/smb2fs.c
fs/smb2/smb2fs.c +1 -1
index aa550a3..52c9f35 100644
@@ -57,7 +57,7 @@ static struct quotactl_ops smb2_quotactl_ops;
 
  /* Definitions of various global variables follow */
 
-int smb2FYI;
+int smb2FYI = 1;
  int smb2ERROR = 1;
  int trace_SMB2;
 
Quoted 7 lines

I got following logs on dmesg.
====================================================
FS-Cache: Netfs 'smb2' registered for caching
fs/smb2/smb2fs.c: SMB2_max_buf_size 0x4000
fs/smb2/smb2fs.c: smb2_init_request_bufs 0
fs/smb2/smb2fs.c: register_filesystem 0
fs/smb2/smb2fs.c: register_key_type -17

-17 is -EEXIST which means ket type with the name is already present. The below patch should fix the problem I think. Could you try and report back?

From: Suresh Jayaraman<[email protected]>
Subject: [PATCH] smb2: rename smb2 spnego key type

.. to avoid key registration failure. register_key_type() doesn't allow key types with same names.

---
  fs/smb2/smb2_spnego.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
fs/smb2/smb2_spnego.c +1 -2
index 6551002..24df95a 100644
@@ -61,7 +61,7 @@ smb2_spnego_key_destroy(struct key *key)
   * keytype for SMB2 spnego keys
   */
  struct key_type smb2_spnego_key_type = {
-	.name		= "cifs.spnego",
+	.name		= "smb2.spnego",
  	.instantiate	= smb2_spnego_key_instantiate,
  	.match		= user_match,
  	.destroy	= smb2_spnego_key_destroy,
 
--

To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 6 lines
-------------------------------------
八木 清之介 (ヤギ シンノスケ)
NTTコムウェア株式会社
ネットワーク・ソリューション事業本部
yagi.shinnosuke-o7dWnD6vFTHqq2nvvmkE/[email protected]
-------------------------------------

A message that is not in the archive (sent off-list or not yet received): 4CDA5955.50409-o7dWnD6vFTHqq2nvvmkE/[email protected]

#31 lore raw
Quoted 6 lines · Shinnosuke Yagi

I patched and tried to mount again.

I mount successfully by smb2.
However, Kernel clashed when I accessed to mounted FS.

I got following messages through netconsole
when Kernel Oops was occuerd.

Kernel Opps occuerd when I execute
ls /mount/point

Client is Ubuntu 10.04 and cifs-util 4.7
Server is Ubuntu 10.04 and Samba 3.5.6

===============================================

BUG: unable to handle kernel

paging request at 75636573 IP:
[<c0501b08>] generic_getxattr+0x2c/0x6a
*pde = 00000000

Oops: 0000 [#1] SMP
last sysfs file: /sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/uevent
Modules linked in:

nls_utf8
smb2
ppdev
rpcsec_gss_krb5
auth_rpcgss
sunrpc
snd_hda_codec_realtek
netconsole
snd_hda_intel
tun
i915
configfs
snd_hda_codec
snd_hwdep
bridge
snd_pcm_oss
snd_mixer_oss
snd_pcm
snd_seq_dummy
snd_seq_oss
snd_seq_midi
drm_kms_helper
stp
llc
lp
snd_rawmidi
drm
snd_seq_midi_event
snd_seq
snd_timer
snd_seq_device
snd
tpm_infineon
i2c_algo_bit
i2c_core
hp_wmi
serio_raw
video
rfkill
soundcore
parport
wmi
output
snd_page_alloc
e1000e
nbd
ata_generic
pata_acpi

Pid: 1842, comm: ls Tainted: GW 2.6.36-rc4+ #1 3647h/HP Compaq 8000 Elite CMT PC
EIP: 0060:[<c0501b08>] EFLAGS: 00010282 CPU: 0
EIP is at generic_getxattr+0x2c/0x6a
EAX: edef9088 EBX: 75636573 ECX: 0000006f EDX: ee399e80
ESI: ee399e80 EDI: 00000000 EBP: ee399e50 ESP: ee399e38
DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
Process ls (pid: 1842, ti=ee398000 task=ee0e6500 task.ti=ee398000)

Stack:

fbf99dbc
fbf9a6fc
75636573
ee399e80
c0501adc
edef9088
ee399e6c
c050210a

00000000
00000000
00000017
00000000
00000000
ee399f90
c050250b
00000000

00000000
edef9088
74737973
702e6d65
7869736f
6c63615f
6363615f
00737365

Call Trace:
[<c0501adc>] ? generic_getxattr+0x0/0x6a
[<c050210a>] ? vfs_getxattr+0x79/0x82
[<c050250b>] ? getxattr+0x8f/0xea
[<c04f41df>] ? path_to_nameidata+0x11/0x2a
[<c04f5ec5>] ? link_path_walk+0x353/0x358
[<c04f4127>] ? mntput+0x13/0x15
[<c04f4127>] ? mntput+0x13/0x15
[<c04f58e3>] ? putname+0x25/0x2e
[<c04f68e7>] ? user_path_at+0x42/0x5f
[<c04f064c>] ? sys_lstat64+0x22/0x28
[<c05e0dfc>] ? _atomic_dec_and_lock+0x2c/0x44
[<c0502626>] ? sys_getxattr+0x36/0x49
[<c042709f>] ? sysenter_do_call+0x12/0x28
Code: 89 e5 57 89 cf 56 89 d6 53 83 ec 0c 8b 50 54 85 f6 8b 52 6c 75 2b eb 35 8b 13 89 5d e8 89 55 f0 89 f2 eb 04 ff 45 f0 42 8b 5d f0 unparseable log message: "<8a> "0b 84 c9 74 06 38 0a 74 ef eb 07 85 d2 8b 5d e8 75 1c 8b 55

EIP: [<c0501b08>]
generic_getxattr+0x2c/0x6a
SS:ESP 0068:ee399e38
CR2: 0000000075636573

---[ end trace b00826b595f2760c ]---

[drm:drm_mode_getfb] *ERROR* invalid framebuffer id
===========================================================

Quoted 82 lines · Shinnosuke Yagi

I patched and tried to mount again.

I mount successfully by smb2.
However, Kernel clashed when I accessed to mounted FS.

I couldn't got any logs, because I did not set kdump.

I will try to get a clashed kernel dump.

Please wait.

Thanks.

Quoted 65 lines · Suresh Jayaraman
Quoted 17 lines · Shinnosuke Yagi

I added some logging messages.

# git diff fs/smb2/smb2fs.c
fs/smb2/smb2fs.c +1 -1
index aa550a3..52c9f35 100644
@@ -57,7 +57,7 @@ static struct quotactl_ops smb2_quotactl_ops;
 
 /* Definitions of various global variables follow */
 
-int smb2FYI;
+int smb2FYI = 1;
 int smb2ERROR = 1;
 int trace_SMB2;
 
Quoted 7 lines

I got following logs on dmesg.
====================================================
FS-Cache: Netfs 'smb2' registered for caching
fs/smb2/smb2fs.c: SMB2_max_buf_size 0x4000
fs/smb2/smb2fs.c: smb2_init_request_bufs 0
fs/smb2/smb2fs.c: register_filesystem 0
fs/smb2/smb2fs.c: register_key_type -17

-17 is -EEXIST which means ket type with the name is already present. The below patch should fix the problem I think. Could you try and report back?

From: Suresh Jayaraman<[email protected]>
Subject: [PATCH] smb2: rename smb2 spnego key type

.. to avoid key registration failure. register_key_type() doesn't allow key
types with same names.

---
fs/smb2/smb2_spnego.c | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
fs/smb2/smb2_spnego.c +1 -2
index 6551002..24df95a 100644
@@ -61,7 +61,7 @@ smb2_spnego_key_destroy(struct key *key)
 * keytype for SMB2 spnego keys
 */
 struct key_type smb2_spnego_key_type = {
- .name = "cifs.spnego",
+ .name = "smb2.spnego",
 .instantiate = smb2_spnego_key_instantiate,
 .match = user_match,
 .destroy = smb2_spnego_key_destroy,
 
--

To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html