[SCM] Samba Shared Repository - branch master updated

Christian Ambach ambi at samba.org
Wed Aug 29 10:59:02 MDT 2012


The branch, master has been updated
       via  6678907 s3:vfs_gpfs: Use directory not file to get fileset id
      from  f31d0d0 vfs_media_harmony: fix some compile warnings with llvm

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 6678907fae43e0d25b578b4e649a2fbd9c5e9d71
Author: Christof Schmitt <christof.schmitt at us.ibm.com>
Date:   Thu Aug 16 12:47:52 2012 -0700

    s3:vfs_gpfs: Use directory not file to get fileset id
    
    The query of the fileset quota needs to determine the file set id first.
    With the currently available interface, this requires opening the file
    to get a file descriptor. For files, this open can fail when a share
    mode is set.
    
    Workaround this by querying the fileset id on the directory instead.
    
    The proper solution would be getting an interface for getting the
    fileset id that does not require opening the file.
    
    Autobuild-User(master): Christian Ambach <ambi at samba.org>
    Autobuild-Date(master): Wed Aug 29 18:58:34 CEST 2012 on sn-devel-104

-----------------------------------------------------------------------

Summary of changes:
 source3/modules/gpfs.c     |   16 +++++++++++++---
 source3/modules/vfs_gpfs.c |   24 ++++++++++++++++++++++--
 2 files changed, 35 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/gpfs.c b/source3/modules/gpfs.c
index db60256..9730d3a 100644
--- a/source3/modules/gpfs.c
+++ b/source3/modules/gpfs.c
@@ -253,8 +253,11 @@ int get_gpfs_fset_id(const char *pathname, int *fset_id)
 	arg.fsn.structType = GPFS_FCNTL_GET_FILESETNAME;
 
 	fd = open(pathname, O_RDONLY);
-	if (fd == -1)
+	if (fd == -1) {
+		DEBUG(1, ("Could not open %s: %s\n",
+			  pathname, strerror(errno)));
 		return fd;
+	}
 
 	err = gpfs_fcntl_fn(fd, &arg);
 	errno_fcntl = errno;
@@ -262,11 +265,18 @@ int get_gpfs_fset_id(const char *pathname, int *fset_id)
 
 	if (err) {
 		errno = errno_fcntl;
+		DEBUG(1, ("GPFS_FCNTL_GET_FILESETNAME for %s failed: %s\n",
+			  pathname, strerror(errno)));
 		return err;
 	}
 
-	return gpfs_getfilesetid_fn(discard_const_p(char, pathname),
-				    arg.fsn.buffer, fset_id);
+	err = gpfs_getfilesetid_fn(discard_const_p(char, pathname),
+				   arg.fsn.buffer, fset_id);
+	if (err) {
+		DEBUG(1, ("gpfs_getfilesetid for %s failed: %s\n",
+			  pathname, strerror(errno)));
+	}
+	return err;
 }
 
 void smbd_gpfs_lib_init()
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index 7a01257..a39187e 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -1541,10 +1541,30 @@ static int vfs_gpfs_get_quotas(const char *path, uid_t uid, gid_t gid,
 			       struct gpfs_quotaInfo *qi_fset)
 {
 	int err;
+	char *dir_path;
+	bool b;
 
-	err = get_gpfs_fset_id(path, fset_id);
+	/*
+	 * We want to always use the directory to get the fileset id,
+	 * because files might have a share mode. We also do not want
+	 * to get the parent directory when there is already a
+	 * directory to avoid stepping in a different fileset.  The
+	 * path passed here is currently either "." or a filename, so
+	 * this is ok. The proper solution would be having a way to
+	 * query the fileset id without opening the file.
+	 */
+	b = parent_dirname(talloc_tos(), path, &dir_path, NULL);
+	if (!b) {
+		errno = ENOMEM;
+		return -1;
+	}
+
+	DEBUG(10, ("path %s, directory %s\n", path, dir_path));
+
+	err = get_gpfs_fset_id(dir_path, fset_id);
 	if (err) {
-		DEBUG(0, ("Get fset id failed, errno %d.\n", errno));
+		DEBUG(0, ("Get fset id failed path %s, dir %s, errno %d.\n",
+			  path, dir_path, errno));
 		return err;
 	}
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list