Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-4765

Permission check of symlink deletion incorrectly throws UnresolvedLinkException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.3-alpha, 3.0.0-alpha1
    • 2.1.0-beta, 0.23.9
    • namenode
    • None
    • Reviewed

    Description

      With permissions enabled, the permission check in FSNamesystem#delete will incorrectly throw an UnresolvedLinkException if the path contains a symlink. This leads to FileContext resolving the symlink and instead deleting the link target.

      The correct check is to see if the user has write permissions on the parent directory of the symlink, e.g.

      -> % ls -ld symtest
      drwxr-xr-x 2 root root 4096 Apr 26 14:12 symtest
      -> % ls -l symtest
      total 12
      lrwxrwxrwx 1 root root 6 Apr 26 14:12 link -> target
      -rw-r--r-- 1 root root 0 Apr 26 14:11 target
      -> % rm -f symtest/link
      rm: cannot remove `symtest/link': Permission denied
      -> % sudo chown andrew symtest
      -> % rm -f symtest/link       
      -> % 
      

      Attachments

        1. hdfs-4765-branch-2-1.patch
          11 kB
          Andrew Wang
        2. hdfs-4765-branch-0.23.patch
          10 kB
          Jason Darrell Lowe
        3. hdfs-4765-2.patch
          11 kB
          Andrew Wang
        4. hdfs-4765-1.patch
          9 kB
          Andrew Wang

        Issue Links

          Activity

            People

              andrew.wang Andrew Wang
              andrew.wang Andrew Wang
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: