r4406: - don't call the xattr unlink hook on unlink unless the link count is 1, otherwise
authorAndrew Tridgell <tridge@samba.org>
Thu, 30 Dec 2004 03:19:27 +0000 (03:19 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:07:44 +0000 (13:07 -0500)
  the xattrs of the remaining link are removed

- fix the handling of attribute set on directories
(This used to be commit fa44e3cce00b75656c85378c7825960540d2f282)

source4/ntvfs/posix/pvfs_setfileinfo.c
source4/ntvfs/posix/pvfs_unlink.c

index 295d2e919e099f624820379b73b75496b6cd0b27..31db6ce630647f85388ba7d839585c2c4164613d 100644 (file)
@@ -365,12 +365,10 @@ NTSTATUS pvfs_setfileinfo(struct ntvfs_module_context *ntvfs,
        /* possibly change the attribute */
        if (newstats.dos.attrib != h->name->dos.attrib) {
                mode_t mode = pvfs_fileperms(pvfs, newstats.dos.attrib);
-               if (h->name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY) {
-                       /* ignore on directories for now */
-                       return NT_STATUS_OK;
-               }
-               if (fchmod(h->fd, mode) == -1) {
-                       return pvfs_map_errno(pvfs, errno);
+               if (!(h->name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY)) {
+                       if (fchmod(h->fd, mode) == -1) {
+                               return pvfs_map_errno(pvfs, errno);
+                       }
                }
        }
 
index 09732d7735b9009a47076fb1adbd469964afcbf0..5f8a828f152a3d3137f23d3e33c64451628c0e25 100644 (file)
@@ -89,9 +89,11 @@ static NTSTATUS pvfs_unlink_one(struct pvfs_state *pvfs,
                return NT_STATUS_FILE_IS_A_DIRECTORY;
        }
 
-       status = pvfs_xattr_unlink_hook(pvfs, name->full_name);
-       if (!NT_STATUS_IS_OK(status)) {
-               return status;
+       if (name->st.st_nlink == 1) {
+               status = pvfs_xattr_unlink_hook(pvfs, name->full_name);
+               if (!NT_STATUS_IS_OK(status)) {
+                       return status;
+               }
        }
 
        /* finally try the actual unlink */