Skip to contentSkip to conversation

cifsd: introduce SMB3 kernel server

bug report Dan Carpenter 6 participants 10 messages Mar 18, 2021 – Apr 6, 2021 1 message not in the archive

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

[ The fs/cifsd/ directory needs to be added to the MAINTAINERS file
so this stuff goes through [email protected] ]

Hello Namjae Jeon,

The patch cabcebc31de4: "cifsd: introduce SMB3 kernel server" from May 14, 2020, leads to the following static checker warning:

	fs/cifsd/transport_rdma.c:1168 smb_direct_post_send_data()
	warn: missing error code 'ret'

fs/cifsd/transport_rdma.c
1150
1151 ret = smb_direct_create_header(t, data_length, remaining_data_length,
1152 &msg);
1153 if (ret) {
1154 atomic_inc(&t->send_credits);
1155 return ret;
1156 }

"ret" is zero.

  1157  
  1158          for (i = 0; i < niov; i++) {
  1159                  struct ib_sge *sge;
  1160                  int sg_cnt;
  1161  
  1162                  sg_init_table(sg, SMB_DIRECT_MAX_SEND_SGES-1);
  1163                  sg_cnt = get_mapped_sg_list(t->cm_id->device,
  1164                                  iov[i].iov_base, iov[i].iov_len,
  1165                                  sg, SMB_DIRECT_MAX_SEND_SGES-1, DMA_TO_DEVICE);
  1166                  if (sg_cnt <= 0) {
  1167                          ksmbd_err("failed to map buffer\n");
  1168                          goto err;

Should ret = -ENOMEM on this path?

  1169                  } else if (sg_cnt + msg->num_sge > SMB_DIRECT_MAX_SEND_SGES-1) {
  1170                          ksmbd_err("buffer not fitted into sges\n");
  1171                          ret = -E2BIG;
  1172                          ib_dma_unmap_sg(t->cm_id->device, sg, sg_cnt,
  1173                                          DMA_TO_DEVICE);
  1174                          goto err;
  1175                  }
  1176  
  1177                  for (j = 0; j < sg_cnt; j++) {
  1178                          sge = &msg->sge[msg->num_sge];
  1179                          sge->addr = sg_dma_address(&sg[j]);
  1180                          sge->length = sg_dma_len(&sg[j]);
  1181                          sge->lkey  = t->pd->local_dma_lkey;
  1182                          msg->num_sge++;
  1183                  }
  1184          }
  1185  
  1186          ret = post_sendmsg(t, send_ctx, msg);
  1187          if (ret)
  1188                  goto err;
  1189          return 0;
  1190  err:
  1191          smb_direct_free_sendmsg(t, msg);
  1192          atomic_inc(&t->send_credits);
  1193          return ret;
  1194  }

regards,
dan carpenter

A message that is not in the archive (sent off-list or not yet received): CAH2r5msOBAho=1W-eY0paj+4P1J+tuw-vFaRGg8oY50dXu6MHQ@mail.gmail.com

#4 lore raw

Namjae was working on a better high level summary of status so I would expect to see a better description of that posted soon. They also restructured the patch set into a smaller set since rereviewing years of their incremental patches would be far more time consuming. It has been presented over the past year or so at various conferences. Although he had done a good job presenting on cifsd at the big Storage Developer Conference last year (and also SambaXP etc.), a lot had improved recently (e.g. it already passes more xfstests than many servers). There have been posts about cifsd on samba-technical and linux-cifs where issues overlapped (e.g. compatibility with attributes that Samba currently saves as xattrs) so the project is well known at least among the samba community (and apparently it is commonly shipped
in various embedded devices already). There is also a public mailing
list for the project so some of the discussion among the core group of developers working on it most is probably on that.

I have been focused on testing it with Linux client. See e.g. the run from a couple days ago

     http://smb3-test-rhel-75.southcentralus.cloudapp.azure.com/#/builders/8/builds/26

and I have been pleasantly surprised at the progress, and have been trying to make sure the test results are very visible, but as Ronnie and others have mentioned, cifsd has already been very very useful for testing the client (Samba is harder to tweak for testing).

Quoted 7 lines · Christoph Hellwig
Quoted 2 lines · Dan Carpenter

[ The fs/cifsd/ directory needs to be added to the MAINTAINERS file
so this stuff goes through [email protected] ]

Err, how did this hit linux-next? I've never even seen the code posted to a mailing list.

Signature · 3 lines
Thanks,

Steve
#5 lore raw

Code that goes into linux-next needs to be posted to the relevant lists, which in this case includes linux-fsdevel and linux-kernel. No backstory of conference and internal trees replaces that in any way.

#6 lore raw
Quoted 4 lines · Christoph Hellwig

Code that goes into linux-next needs to be posted to the relevant lists, which in this case includes linux-fsdevel and linux-kernel. No backstory of conference and internal trees replaces that in any way.

Yes - agree.

When I last talked with Namjae (and looks like he asked others for opinions as well
how to restructure the patch series to be easier to review on linux-fsdevel), the
plan was to send the patches to fsdevel as the smaller set (same as just went in linux-next) ASAP, but he just finished an important piece of the description (the updated protocol feature implementation summary) last night which
he asked me (and probably others) to review before sending it out.

Signature · 3 lines
Thanks,

Steve
#7 lore raw
In reply to Dan Carpenter
Quoted 1 line · Dan Carpenter

[ cifsd: introduce SMB3 kernel server"

Is it to be Linux policy that it will give in-kernel
support for only for smb3, or is it planned to move the rest of the proto into the kernel as well? It sorta seems like earlier parts of the protocol, still dominant on home networks, though it seems linux not supporting all of linux's smb devices, from smb2.1 and before.

I'm sure those clients would benefit as well, being kernel services could allow for a lower latency with potentially faster response time from being a kernel service instead of user-mode client? Is that also planned? Isn't the base of an smb3 server the same functions of an smb2.x server with the new smb3 extensions?

Thanks!

#8 lore raw
Quoted 7 lines · L. A. Walsh
Quoted 1 line · Dan Carpenter

[ cifsd: introduce SMB3 kernel server"

Is it to be Linux policy that it will give in-kernel
support for only for smb3, or is it planned to move the rest of the proto into the kernel as well? It sorta seems like earlier parts of the protocol, still dominant on home networks, though it seems linux not supporting all of linux's smb devices, from smb2.1 and before.

smb1 (aka cifs) is unsecure, out of support and being actively deprecated for over 10 years. Microsoft is uninstalling the smb1 server on Windows updates. That's how hard they want to kill it. Samba is planning to drop smb1 too eventually.

https://aka.ms/stopusingsmb1
https://aka.ms/smb1rs3

Quoted 5 lines

I'm sure those clients would benefit as well, being kernel services could allow for a lower latency with potentially faster response time from being a kernel service instead of user-mode client? Is that also planned? Isn't the base of an smb3 server the same functions of an smb2.x server with the new smb3 extensions?

AFAICT Namjae's ksmbd support smb2 and above.

Cheers,

Signature · 4 lines
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)
#9 lore raw

Re: cifsd: introduce <SMB2n3> kernel server

Quoted 13 lines · Aurélien Aptel
Quoted 10 lines · L. A. Walsh
Quoted 2 lines · Dan Carpenter

[ cifsd: introduce SMB3 kernel server"

Is it to be Linux policy that it will give in-kernel
support for only for smb3, or is it planned to move the rest of the proto into the kernel as well? It sorta seems like earlier parts of the protocol, still dominant on home networks, though it seems linux not supporting all of linux's smb devices, from smb2.1 and before.

Quoted 5 lines

smb1 (aka cifs) is unsecure, out of support and being actively deprecated for over 10 years. Microsoft is uninstalling the smb1 server on Windows updates. That's how hard they want to kill it. Samba is planning to drop smb1 too eventually.

Dropping Smb1 support for linux-serving would seem to be a reasonable step, since I would be hard-pressed to find a client that still only talked Smb1 (clients from XP-era).

I am more concerned about the more secure smb2 & smb2.1 dialects. I have heard there is a security difference even between 2 & 2.1, though, I don't often see a breakout between 2.0(only)+2.1, with both
seeming to be lumped in under Smb2.

So lets say dropping smb1 isn't an issue...

Quoted 8 lines
Quoted 5 lines

Isn't the base of an smb3 server the same functions of an smb2.x server with the new smb3 extensions?

AFAICT Namjae's ksmbd support smb2 and above.

---
Then would it be a problem if it is called something like
"smb2n3" so it can be readily understood to support both?

It's just a small comfort issue, since 'smb3' really doesn't
seem to be very convincing about its smb2-support.

Quoted 2 lines

Cheers,

Likewise!

#10 lore raw

RE: cifsd: introduce <SMB2n3> kernel server

Quoted 34 lines · Aurélien Aptel
Quoted 13 lines
Quoted 10 lines · L. A. Walsh
Quoted 2 lines · Dan Carpenter

[ cifsd: introduce SMB3 kernel server"

Is it to be Linux policy that it will give in-kernel support for only for smb3, or is it planned to move the rest of the proto into the kernel as well? It sorta seems like earlier parts of the protocol, still dominant on home networks, though it seems linux not supporting all of linux's smb devices, from smb2.1 and before.

Quoted 5 lines

smb1 (aka cifs) is unsecure, out of support and being actively deprecated for over 10 years. Microsoft is uninstalling the smb1 server on Windows updates. That's how hard they want to kill it. Samba is planning to drop smb1 too eventually.

Dropping Smb1 support for linux-serving would seem to be a reasonable step, since I would be hard- pressed to find a client that still only talked Smb1 (clients from XP-era).

I am more concerned about the more secure smb2 & smb2.1 dialects.
I have heard there is a security difference even between 2 & 2.1, though, I don't often see a breakout between 2.0(only)+2.1, with both seeming to be lumped in under Smb2.

So lets say dropping smb1 isn't an issue...

Quoted 6 lines
Quoted 5 lines

Isn't the base of an smb3 server the same functions of an smb2.x server with the new smb3 extensions?

Quoted 8 lines
Quoted 2 lines

AFAICT Namjae's ksmbd support smb2 and above.

---
Then would it be a problem if it is called something like "smb2n3" so it can be readily understood
to support both?

It's just a small comfort issue, since 'smb3' really doesn't seem to be very convincing about its
smb2-support.

You probably didn't check the cover letter of ksmbd patch series. Supported dialects was specified in it. See:
https://www.spinics.net/lists/linux-cifs/msg21154.html
Well, It seems unnecessary to rename subject that is more difficult to understand because it is specified in the document and cover letter.

Thanks!

Quoted 5 lines
Quoted 3 lines

Cheers,

Likewise!