Fix bug disclosed by lock8 torture test
authorVolker Lendecke <vl@samba.org>
Mon, 18 May 2009 04:02:07 +0000 (06:02 +0200)
committerMichael Adam <obnox@samba.org>
Wed, 20 May 2009 13:38:20 +0000 (15:38 +0200)
We have to drop the gpfs level share modes, regardless of whether we put
the file into the pending close queue.

source/modules/vfs_gpfs.c

index 5aaba7b03691c673b42ee81c9a219477727f5e77..8ca8d18f8e578bd79cea3f9e881726370a060994 100644 (file)
@@ -49,6 +49,19 @@ static int vfs_gpfs_kernel_flock(vfs_handle_struct *handle, files_struct *fsp,
        return 0;
 }
 
+static int vfs_gpfs_close(vfs_handle_struct *handle, files_struct *fsp)
+{
+       int result;
+
+       if ((fsp->fh != NULL) && (fsp->fh->fd != -1)) {
+               set_gpfs_sharemode(fsp, 0, 0);
+       }
+
+       result = fd_close_posix(fsp);
+
+       return result;
+}
+
 static int vfs_gpfs_setlease(vfs_handle_struct *handle, files_struct *fsp, 
                             int leasetype)
 {
@@ -932,6 +945,10 @@ static vfs_op_tuple gpfs_op_tuples[] = {
          SMB_VFS_OP_FCHMOD,
          SMB_VFS_LAYER_TRANSPARENT },
 
+        { SMB_VFS_OP(vfs_gpfs_close),
+         SMB_VFS_OP_CLOSE,
+         SMB_VFS_LAYER_TRANSPARENT },
+
         { SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP }
 
 };