OpenWrt Forum Archive

Topic: samba share - 'Bad file descriptor' problem

The content of this topic has been archived on 28 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Greetings, i have a problem on my router fonera 2200, the problem happens after a successful mount on a resource of a linux machine

mount.cifs //device/share /mnt/share -o username=root

i'm able to read files and directorires but i can't create files or directories, it gives

echo hi >/mnt/share/test
-ash: cannot create /mnt/share/test: Bad file descriptor

file append works well

echo hi >>/mnt/share/test

obviously the file should be already present on the filesystem
I have tried some options on mount.cifs:

mount.cifs //device/share /mnt/share1 -o username=root,rw,dir_mode=0777,file_mode=0777

but no luck

here is the server log for a successful transaction using a windows client (test.txt)

[2010/11/10 13:59:42, 3] ../smbd/process.c:process_smb(1091)
  Transaction 68 of length 90
[2010/11/10 13:59:42, 3] ../smbd/process.c:switch_message(886)
  switch message SMBntcreateX (pid 133) conn 0x8c90450
[2010/11/10 13:59:42, 3] ../smbd/sec_ctx.c:set_sec_ctx(288)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 0
[2010/11/10 13:59:42, 3] ../smbd/error.c:error_packet(105)
  error string = Unknown error 17
[2010/11/10 13:59:42, 3] ../smbd/error.c:error_packet(129)
  error packet at ../smbd/trans2.c(2200) cmd=162 (SMBntcreateX) NT_STATUS_OBJECT_NAME_COLLISION
[2010/11/10 13:59:42, 3] ../smbd/process.c:process_smb(1091)
  Transaction 69 of length 80
[2010/11/10 13:59:42, 3] ../smbd/process.c:switch_message(886)
  switch message SMBtrans2 (pid 133) conn 0x8c90450
[2010/11/10 13:59:42, 3] ../smbd/trans2.c:call_trans2qfilepathinfo(2418)
  call_trans2qfilepathinfo: TRANSACT2_QPATHINFO: level = 257
[2010/11/10 13:59:42, 3] ../smbd/trans2.c:call_trans2qfilepathinfo(2452)
  call_trans2qfilepathinfo . (fnum = -1) level=257 call=5 total_data=0
[2010/11/10 13:59:42, 3] ../smbd/process.c:process_smb(1091)
  Transaction 70 of length 74
[2010/11/10 13:59:42, 3] ../smbd/process.c:switch_message(886)
  switch message SMBtrans2 (pid 133) conn 0x8c90450
[2010/11/10 13:59:42, 3] ../smbd/trans2.c:call_trans2qfsinfo(1775)
  call_trans2qfsinfo: level = 261
[2010/11/10 13:59:42, 3] ../smbd/process.c:process_smb(1091)
  Transaction 71 of length 74
[2010/11/10 13:59:42, 3] ../smbd/process.c:switch_message(886)
  switch message SMBtrans2 (pid 133) conn 0x8c90450
[2010/11/10 13:59:42, 3] ../smbd/trans2.c:call_trans2qfsinfo(1775)
  call_trans2qfsinfo: level = 261
[2010/11/10 13:59:42, 3] ../smbd/process.c:process_smb(1091)
  Transaction 72 of length 116
[2010/11/10 13:59:42, 3] ../smbd/process.c:switch_message(886)
  switch message SMBntcreateX (pid 133) conn 0x8c90450
[2010/11/10 13:59:42, 3] ../smbd/dosmode.c:unix_mode(111)
  unix_mode(test.txt) returning 0744
[2010/11/10 13:59:42, 2] ../smbd/open.c:open_file(245)
  root opened file test.txt read=No write=Yes (numopen=2)
[2010/11/10 13:59:42, 3] ../smbd/process.c:process_smb(1091)
  Transaction 73 of length 74
[2010/11/10 13:59:42, 3] ../smbd/process.c:switch_message(886)
  switch message SMBtrans2 (pid 133) conn 0x8c90450
[2010/11/10 13:59:42, 3] ../smbd/trans2.c:call_trans2qfsinfo(1775)
  call_trans2qfsinfo: level = 261
[2010/11/10 13:59:42, 3] ../smbd/process.c:process_smb(1091)
  Transaction 74 of length 76
[2010/11/10 13:59:42, 3] ../smbd/process.c:switch_message(886)
  switch message SMBtrans2 (pid 133) conn 0x8c90450
[2010/11/10 13:59:42, 3] ../smbd/trans2.c:call_trans2qfilepathinfo(2363)
  call_trans2qfilepathinfo: TRANSACT2_QFILEINFO: level = 257
[2010/11/10 13:59:42, 3] ../smbd/trans2.c:call_trans2qfilepathinfo(2452)
  call_trans2qfilepathinfo test.txt (fnum = 11454) level=257 call=7 total_data=0
[2010/11/10 13:59:42, 3] ../smbd/process.c:process_smb(1091)
  Transaction 75 of length 88
[2010/11/10 13:59:42, 3] ../smbd/process.c:switch_message(886)
  switch message SMBtrans2 (pid 133) conn 0x8c90450
[2010/11/10 13:59:42, 3] ../smbd/trans2.c:call_trans2setfilepathinfo(3267)
  call_trans2setfilepathinfo(8) test.txt (fnum 11454) info_level=260 totdata=8
[2010/11/10 13:59:42, 3] ../smbd/process.c:process_smb(1091)
  Transaction 76 of length 120
[2010/11/10 13:59:42, 3] ../smbd/process.c:switch_message(886)
  switch message SMBtrans2 (pid 133) conn 0x8c90450
[2010/11/10 13:59:42, 3] ../smbd/trans2.c:call_trans2setfilepathinfo(3267)
  call_trans2setfilepathinfo(8) test.txt (fnum 11454) info_level=257 totdata=40
[2010/11/10 13:59:43, 3] ../smbd/process.c:process_smb(1091)
  Transaction 77 of length 16632
[2010/11/10 13:59:43, 3] ../smbd/process.c:switch_message(886)
  switch message SMBwrite (pid 133) conn 0x8c90450
[2010/11/10 13:59:43, 3] ../smbd/reply.c:reply_write(2607)
  write fnum=11454 num=16580 wrote=16580
[2010/11/10 13:59:43, 3] ../smbd/process.c:process_smb(1091)
  Transaction 78 of length 13090
[2010/11/10 13:59:43, 3] ../smbd/process.c:switch_message(886)
  switch message SMBwrite (pid 133) conn 0x8c90450
[2010/11/10 13:59:43, 3] ../smbd/reply.c:reply_write(2607)
  write fnum=11454 num=13038 wrote=13038
[2010/11/10 13:59:43, 3] ../smbd/process.c:process_smb(1091)
  Transaction 79 of length 74
[2010/11/10 13:59:43, 3] ../smbd/process.c:switch_message(886)
  switch message SMBtrans2 (pid 133) conn 0x8c90450
[2010/11/10 13:59:43, 3] ../smbd/trans2.c:call_trans2qfsinfo(1775)
  call_trans2qfsinfo: level = 261
[2010/11/10 13:59:43, 3] ../smbd/process.c:process_smb(1091)
  Transaction 80 of length 160
[2010/11/10 13:59:43, 3] ../smbd/process.c:switch_message(886)
  switch message SMBntcreateX (pid 133) conn 0x8c90450
[2010/11/10 13:59:43, 3] ../smbd/error.c:error_packet(129)
  error packet at ../smbd/nttrans.c(730) cmd=162 (SMBntcreateX) NT_STATUS_OBJECT_PATH_NOT_FOUND
[2010/11/10 13:59:43, 3] ../smbd/process.c:process_smb(1091)
  Transaction 81 of length 120
[2010/11/10 13:59:43, 3] ../smbd/process.c:switch_message(886)
  switch message SMBtrans2 (pid 133) conn 0x8c90450
[2010/11/10 13:59:43, 3] ../smbd/trans2.c:call_trans2setfilepathinfo(3267)
  call_trans2setfilepathinfo(8) test.txt (fnum 11454) info_level=257 totdata=40
[2010/11/10 13:59:43, 3] ../smbd/process.c:process_smb(1091)
  Transaction 82 of length 45
[2010/11/10 13:59:43, 3] ../smbd/process.c:switch_message(886)
  switch message SMBclose (pid 133) conn 0x8c90450
[2010/11/10 13:59:43, 3] ../smbd/reply.c:reply_close(2884)
  close fd=23 fnum=11454 (numopen=2)
[2010/11/10 13:59:43, 2] ../smbd/close.c:close_normal_file(272)
  root closed file test.txt (numopen=1) 
[2010/11/10 13:59:43, 3] ../smbd/process.c:process_smb(1091)
  Transaction 83 of length 112
[2010/11/10 13:59:43, 3] ../smbd/process.c:switch_message(886)
  switch message SMBtrans2 (pid 133) conn 0x8c90450
[2010/11/10 13:59:43, 3] ../smbd/trans2.c:call_trans2findfirst(1351)
  call_trans2findfirst: dirtype = 22, maxentries = 1366, close_after_first=1, close_if_end = 2 requires_resume_key = 4 level = 0x104, max_data_bytes = 16384
[2010/11/10 13:59:43, 3] ../smbd/dir.c:dptr_create(476)
  creating new dirptr 256 for path ./, expect_close = 1

here the another one using the fonera as client (a write on the mount folder - test.txt)

 
[2010/11/10 00:26:03, 3] ../smbd/process.c:process_smb(1091)
  Transaction 14 of length 96
[2010/11/10 00:26:03, 3] ../smbd/process.c:switch_message(886)
  switch message SMBtrans2 (pid 137) conn 0x8f108a0
[2010/11/10 00:26:03, 3] ../smbd/trans2.c:call_trans2qfilepathinfo(2418)
  call_trans2qfilepathinfo: TRANSACT2_QPATHINFO: level = 512
[2010/11/10 00:26:03, 3] ../smbd/trans2.c:call_trans2qfilepathinfo(2439)
  call_trans2qfilepathinfo: SMB_VFS_LSTAT of test.txt failed (Unknown error 2)
[2010/11/10 00:26:03, 3] ../smbd/error.c:error_packet(105)
  error string = Unknown error 22
[2010/11/10 00:26:03, 3] ../smbd/error.c:error_packet(129)
  error packet at ../smbd/trans2.c(2200) cmd=50 (SMBtrans2) NT_STATUS_INVALID_HANDLE
[2010/11/10 00:27:03, 3] ../smbd/sec_ctx.c:set_sec_ctx(288)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 0
[2010/11/10 00:28:03, 3] ../smbd/sec_ctx.c:set_sec_ctx(288)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 0

After some tests i have noticed that using the smb common  libraries i am able to create and write files using smbclient, but there is no smbmount (smbfs) port (as far as i know) so i cant mount folders, i just want to use my linux server as storage for my fonera

can someone address me or give me any suggestion plz?
thanks

(Last edited by protomax on 10 Nov 2010, 14:56)

I just noticed that the linux device was using an old samba version, after patching it the problem has been fixed, so is not openwrt related

(Last edited by protomax on 15 Nov 2010, 14:02)

The discussion might have continued from here.