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

Permission check of symlink deletion incorrectly throws UnresolvedLinkException

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.3-alpha, 3.0.0-alpha1
    • Fix Version/s: 2.1.0-beta, 0.23.9
    • Component/s: namenode
    • Labels:
      None
    • Hadoop Flags:
      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-0.23.patch
          10 kB
          Jason Lowe
        2. hdfs-4765-branch-2-1.patch
          11 kB
          Andrew Wang
        3. hdfs-4765-2.patch
          11 kB
          Andrew Wang
        4. hdfs-4765-1.patch
          9 kB
          Andrew Wang

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: