Re: blocking write() after disconnecting cifs server

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

 



On Tue, 3 Dec 2013 14:16:08 +0100 (CET)
mail654@xxxxxx wrote:

> Hello,
> 
> write() from cifs kernel driver blocks when disconnecting the cifs server. The blocking call didn't return after 30 minutes. Client and server are connected via a switch and server's LAN cable is unplugged during the write call. I use kernel 3.11.8 and mounted without "hard" option.
> 
> Is there a possibility for an non-blocking write() without using O_SYNC or "directio" mount option?
> 
> Way to reproduce the scenario: Below is a sample program which calls write() in a loop. The error messages appear when unplugging the cable during this loop.
> 
> Kind regards,
> Hagen
> 
> CIFS VFS: sends on sock ffff88003710c280 stuck for 15 seconds
> CIFS VFS: Error -11 sending data on socket to server
> 
> #include <fstream>
> #include <iostream>
> int main () {
>   const int size = 100000;
>   char buffer[size];
>   std::ofstream outfile("/mnt/new.bin",std::ofstream::binary);
>   if (!outfile.is_open())
>   {
>     return 1;
>   }
>   for (int idx=0; idx<10000 && outfile.good(); idx++)
>   {
>     outfile.write(buffer,size);
>     std::cout << "written, size=" << size << std::endl;
>   }
>   std::cout << "finished " << outfile.good() << std::endl;
>   outfile.close();
>   return 0;
> }

A hang of that length is unexpected. If you're able to reproduce this,
can you get the stack from the task issuing the write at the time?

    $ cat /proc/<pid>/stack

That might give us a clue as to what it's doing.
-- 
Jeff Layton <jlayton@xxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux