[RFC] When locking an inexistent file, NFSv3 and NFSv4 get different result.

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

 



When locking an inexistent file, NFSv3 and NFSv4 get different result.

A: Test procedure:

         Client              Server
       ---------------+----------------
step1:  open file     |
step2:                |   delete file
step3:  lock file     |
step4:  close file    |
                      V

   On NFSv3: lock file fail, and return ESTALE at step3.
   On NFSv4: lock file success, and return OK at step3.

B: Reason:

   NFSv4 server open file when client open the file at step1.
         so it can lock file success at step3.
   NFSv3 server don't open file when client open the file at step1,
         but open file at step3, so lock fail caused by open file fail.

C: Suggestion:

   I suggest modifying the NFSv3 to accordding with NFSv4. As followed:

   1. Add two NLMPROCs for nlm.

      NLMPROC_OPEN:  client sent it to server, and server open file
      NLMPROC_CLOSE: client sent it to server, and server close file

   2. 
     If use NLM, client send NLMPROC_OPEN request to server when client open file,
     and send NLMPROC_CLOSE request when client close file.

            client                  server
              |   nfs.lookup request   |
         Open |----------------------->|
              |    nfs.lookup reply    |
              |<-----------------------|
              |                        |
              |  NLMPROC_OPEN request  |
              |----------------------->| open file and add it to nlm_files list
              |   NLMPROC_OPEN reply   |  
              |<-----------------------|
              |                        |
        Lock  |  NMLPROC_LOCK request  |
              |----------------------->| use the file opened before 
              |   NMLPROC_LOCK reply   |
              |<-----------------------|
              |                        |
        Close |  NMLPROC_CLOSE request |
              |----------------------->| remove the file from nlm_files list
              |   NMLPROC_CLOSE reply  |
              |<-----------------------|
              V                        V

-- 
Regards
Mi Jinlong

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux