Print this page
7656 unlinking directory on tmpfs can cause kernel panic

Split Close
Expand all
Collapse all
          --- old/usr/src/man/man2/unlink.2.man.txt
          +++ new/usr/src/man/man2/unlink.2.man.txt
↓ open down ↓ 39 lines elided ↑ open up ↑
  40   40  
  41   41         When the file's link count becomes 0 and no process has the file open,
  42   42         the space occupied by the file will be freed and the file is no longer
  43   43         accessible.  If one or more processes have the file open when the last
  44   44         link is removed, the link is removed before unlink() or unlinkat()
  45   45         returns, but the removal of the file contents is postponed until all
  46   46         references to the file are closed.
  47   47  
  48   48  
  49   49         If the path argument is a directory and the filesystem supports
  50      -       unlink() and unlinkat() on directories, the directory is unlinked from
  51      -       its parent with no cleanup being performed.  In UFS, the disconnected
  52      -       directory will be found the next time the filesystem is checked with
  53      -       fsck(1M). The unlink() and unlinkat() functions will not fail simply
  54      -       because a directory is not empty. The user with appropriate privileges
  55      -       can orphan a non-empty directory without generating an error message.
       50 +       unlink() and unlinkat() on directories the behaviour is dependent on
       51 +       the filesystem.
  56   52  
  57   53  
  58   54         If the path argument is a directory and the filesystem does not support
  59   55         unlink() and unlink() on directories (for example, ZFS), the call will
  60   56         fail with errno set to EPERM.
  61   57  
  62   58  
  63   59         Upon successful completion, unlink() and unlinkat() will mark for
  64   60         update the st_ctime and st_mtime fields of the parent directory.  If
  65   61         the file's link count is not 0, the st_ctime field of the file will be
↓ open down ↓ 107 lines elided ↑ open up ↑
 173  169         +--------------------+----------------------------------------------+
 174  170         |MT-Level            | Async-Signal-Safe                            |
 175  171         +--------------------+----------------------------------------------+
 176  172  
 177  173  SEE ALSO
 178  174         rm(1), close(2), link(2), open(2), rmdir(2), remove(3C), attributes(5),
 179  175         privileges(5), fsattr(5)
 180  176  
 181  177  
 182  178  
 183      -                                 May 18, 2007                        UNLINK(2)
      179 +                               December 15, 2016                     UNLINK(2)
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX