Solved Issue with QFileSystemWatcher in Linux system with directory shared by windows(Using CIFS protocol)
-
Hello everyone!
Recently,i use QFileSystemWatcher class to monitor Directory in Linux(RedHat6.5).The target directory is shared by windows server system through CIFS protocol, and the directory is mounted on the Linux successfully as well. I have priority to Read/Write in the target directory.But I found a problem that if the windows server create a sub-directory in the monitor path, the FileSystemWatch class doesn't work at all. However, if I create a sub-directory in target path from my Linux Client,the FileSystemWatch class is able to monitor the change of Directory in time and feed back. So I am wondering What's the problem of my App and How to solve it ?PS: the mount order was recorded in /etc/fstab as follows:
//192.168.10.69/win2linux /mnt/windows cifs auto,username=myname,password=mypasswd,rw,uid=0,gid=0,file_mod=0777,dir_mode=0777,iocharset=utf8,codepage=cp936,0 0 -
@tudiudiu
It has been observed in the past that, for example,QFileSystemWatcher
does not work on NFS-mounted remote drives. This is not a Qt issue, it is because the underlying Linux file change notifier does not raise the notification.Doubtless at some level in Linux your CIFS protocol/create directory does not raise the Linux file modified notification. You could Google for that, but there may be nothing you can do about it, as in the NFS case.
-
@JonB:
Hi~JobB^_^
I really appreciate your kindly help, which is of great importance to me.
Since it not a Qt issue, I accept your suggestion that do not waste much time on that problem.There is no doubt that all of my effort would be in vain if I try to solve a Linux kernel problem by Qt program.
Next step, I have a plan that share my Linux Client's Directory for my Windows' Server through SAMBA protocol , so that the Windows Server can product the data in Linux Client directly .The production file would change to be Local data rather than remote data for Linux client as soon as I optimize the NFS structure. I believe QFileSystemWatcher would come back to normal, and everything will be fine~~~~
Sincere thanks for your help and guidance again, and wish you success in work! -
@JonB
By the way, how to finish this topic as "solved" ? Now the flag of this topic is "unsolved".
I am freshmen of Qt Forum,please give me a hand,thank you. -
@tudiudiu said in Issue with QFileSystemWatcher in Linux system with directory shared by windows(Using CIFS protocol):
By the way, how to finish this topic as "solved" ?
On the bottom click on "Topic Tools" and then "Mark as Solved".
-
Next step, I have a plan that share my Linux Client's Directory for my Windows' Server through SAMBA protocol , so that the Windows Server can product the data in Linux Client directly .The production file would change to be Local data rather than remote data for Linux client as soon as I optimize the NFS structure. I believe QFileSystemWatcher would come back to normal, and everything will be fine~~~
You may have a similar problem with Samba, e.g. http://lists.qt-project.org/pipermail/qt-interest-old/2010-December/030038.html. Also see http://www.qtcentre.org/threads/28162-QFileSystemWatcher-on-a-network-mount for a possible workaround to these problems.
-
@jsulm
Oh~~~~~
thanks,I got it~~~
Thank you very much,jsulm^_^ -
@JonB
Thanks jonB, I have download the website you recommended , I will do some test as the instruction and tell you the result.Wait for my reply please. -
@JonB
hi~Jonb
My test have been completed and it does work.
Let me share my experience about "QFileSystemWatcher-on-a-network-mount":General speaking , I exchange the share(mount) direction. According to the experiments time by time, The QFileSystemWatcher doesn't work in remote mount path.A contrary proposition could be concluded that QFileSystemWatcher class only does work in local path. That is the reason why I have exchange the share direction.
I create a directory named "/opt/linux2win" in my Linux Client Machine(Specification:HP Z800, IP:192.168.68.69) which is installed the Qt program(include QFileSystemWatcher).That directory is absolutely existed in Local machine. So the free space in this directory is local storage path. Then I configure the samba-client to share this directory for my Windows server((Specification:Dell,IP:192.168.68.51).If you open web-browser and input \\192.168.68.69 in your windows server,you can see the shared directory named "linux2win"(read/write 0777). Then the Windows server acquired data and owned the rights to create new file in shared directory through samba client. Although all of the new files were transferred by network, no mater what protocol you used(NFS? SAMBA? CIFS?), the final storage destination of the file is the local path of the local machine in which QFileSystemWatcher monitor on. So the directory change SIGNAL could be triggered by local machine and the connected SLOT would finish what we want to do as wish.
Ok~That's all . Thanks for @JonB again~~
Hope our experience is helpful to the person who meet the similar problem.