Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Issue with QFileSystemWatcher in Linux system with directory shared by windows(Using CIFS protocol)

Issue with QFileSystemWatcher in Linux system with directory shared by windows(Using CIFS protocol)

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 3 Posters 2.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tudiudiu
    wrote on last edited by
    #1

    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

    JonBJ 1 Reply Last reply
    0
    • T tudiudiu

      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

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @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.

      T 1 Reply Last reply
      3
      • T Offline
        T Offline
        tudiudiu
        wrote on last edited by
        #3

        @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!

        JonBJ 1 Reply Last reply
        0
        • JonBJ JonB

          @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.

          T Offline
          T Offline
          tudiudiu
          wrote on last edited by
          #4

          @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.0_1518135745819_QQ图片20180209082146.png

          jsulmJ 1 Reply Last reply
          0
          • T tudiudiu

            @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.0_1518135745819_QQ图片20180209082146.png

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by jsulm
            #5

            @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".

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            T 1 Reply Last reply
            2
            • T tudiudiu

              @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!

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @tudiudiu

              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.

              T 2 Replies Last reply
              2
              • jsulmJ jsulm

                @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".

                T Offline
                T Offline
                tudiudiu
                wrote on last edited by
                #7

                @jsulm
                Oh~~~~~
                thanks,I got it~~~
                Thank you very much,jsulm^_^

                1 Reply Last reply
                0
                • JonBJ JonB

                  @tudiudiu

                  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.

                  T Offline
                  T Offline
                  tudiudiu
                  wrote on last edited by
                  #8

                  @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.

                  1 Reply Last reply
                  1
                  • JonBJ JonB

                    @tudiudiu

                    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.

                    T Offline
                    T Offline
                    tudiudiu
                    wrote on last edited by
                    #9

                    @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.

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved