[SCM] Samba Shared Repository - branch master updated

Christof Schmitt cs at samba.org
Sun Jul 13 03:27:03 MDT 2014


The branch, master has been updated
       via  02bcdd1 s3:smbd: initialize stat_ex buffer in smbd_dirptr_get_entry()
       via  26290ba s3:vfs:gpfs: log when winAttr-garbage is detected (by heuristics) in is_offline
       via  31e6750 s3:vfs:gpfs: fix flapping offline: always get winAttrs from gpfs for is_offline
       via  573ca6e s3:vfs:gpfs: store the winAttrs in the struct_ex when we got them in vfs_gpfs_fstat()
      from  7c5ea40 s3:smb2_read: let smb2_sendfile_send_data() behave like send_file_readX()

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


- Log -----------------------------------------------------------------
commit 02bcdd109fb24a369c05dceabfdc1b5edd291aeb
Author: Michael Adam <obnox at samba.org>
Date:   Thu Jul 3 10:00:13 2014 +0200

    s3:smbd: initialize stat_ex buffer in smbd_dirptr_get_entry()
    
    This prevents random garbage in the vfs_private member.
    Usually it should not be a problem to leave initialization
    of the vfs_private to the vfs module who wants to use it,
    but further down in the directory listing code, in
    vfswrap_readdir, there is in optimization introduced
    with 2a65e8befef004fd18d17853a1b72155752346c8, to call
    fstatat if possible to already fill stat info in the
    readdir call.
    
    The problem is that this calls fstatat directly,
    not going through VFS, but still making the stat buffer
    valid, leaving vfs_private with random garbage.
    Hence a vfs module using vfs_private, like vfs_gpfs
    does for offline info (and winAttrs in general)
    does not have a chance to tell whether the vfs_private
    is valid if the stat buffer is marked valid.
    This is a reason for the "flapping offline flag" problem
    of the vfs_gpfs module.
    
    Initializing the vfs_private to 0 here will for the
    vfs_gpfs module result in files being marked online
    always in a directory listing. So this is not a real fix
    but it does at least make the problem less random.
    
    A real general fix might be to implement SMB_VFS_FSTATAT()
    and use it here.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    
    Autobuild-User(master): Christof Schmitt <cs at samba.org>
    Autobuild-Date(master): Sun Jul 13 11:26:58 CEST 2014 on sn-devel-104

commit 26290ba8a45d4caf935995284a111ec57f77cfd7
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jul 9 23:56:34 2014 +0200

    s3:vfs:gpfs: log when winAttr-garbage is detected (by heuristics) in is_offline
    
    In is_offline(), check whether the winAttrs are filled with bits
    outside 0xFFFF and log it prominently: Since GPFS only
    fills 0xFFFF, this could be due to an uninitialized buffer
    (or another vfs module filling vfs_private? ...).
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>

commit 31e67507144aae8d5a8ec49587ac89d2d94636f0
Author: Michael Adam <obnox at samba.org>
Date:   Thu Jul 3 10:10:11 2014 +0200

    s3:vfs:gpfs: fix flapping offline: always get winAttrs from gpfs for is_offline
    
    There is a problem of flapping offline due to uninitialized
    stat buffers. Due to a optimization in vfswrap_readdir which
    directly calling fastatat (i.e. not through vfs), marking the
    stat buffer valid, there is nothing this module can do about
    it and hence can not currently not rely on the vaildity of
    the stat buffer.
    
    By always calling out to GPFS even when the stat buffer is
    flagged valid, we can always return correct offline information,
    thereby sacrificing the readdir optimization.
    
    Pair-Programmed-With: Volker Lendecke <vl at samba.org>
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>

commit 573ca6ef6b8376800d8fc988d67909e103b74656
Author: Michael Adam <obnox at samba.org>
Date:   Thu Jul 3 10:07:37 2014 +0200

    s3:vfs:gpfs: store the winAttrs in the struct_ex when we got them in vfs_gpfs_fstat()
    
    This may (e.g.) have lead to some occurrences of flapping offline bits.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>

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

Summary of changes:
 source3/modules/vfs_gpfs.c |   10 +++++++---
 source3/smbd/dir.c         |    2 +-
 2 files changed, 8 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index 5ad2595..c94e4e8 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -1622,6 +1622,7 @@ static int vfs_gpfs_fstat(struct vfs_handle_struct *handle,
 		sbuf->st_ex_calculated_birthtime = false;
 		sbuf->st_ex_btime.tv_sec = attrs.creationTime.tv_sec;
 		sbuf->st_ex_btime.tv_nsec = attrs.creationTime.tv_nsec;
+		sbuf->vfs_private = attrs.winAttrs;
 	}
 	return 0;
 }
@@ -1818,9 +1819,12 @@ static bool vfs_gpfs_is_offline(struct vfs_handle_struct *handle,
 		return -1;
 	}
 
-	if (VALID_STAT(*sbuf)) {
-		attrs.winAttrs = sbuf->vfs_private;
-	} else {
+	if (VALID_STAT(*sbuf) && (sbuf->vfs_private & ~0x0FFFF) != 0) {
+		DEBUG(0, ("vfs_gpfs_is_offline: valid stat but "
+			  "uninitialized winAttrs (0x%08x)?\n",
+			  (uint32_t)sbuf->vfs_private));
+	}
+	{
 		int ret;
 		ret = get_gpfs_winattrs(path, &attrs);
 
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 038281e..818f778 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -1126,7 +1126,7 @@ bool smbd_dirptr_get_entry(TALLOC_CTX *ctx,
 	while (true) {
 		long cur_offset;
 		long prev_offset;
-		SMB_STRUCT_STAT sbuf;
+		SMB_STRUCT_STAT sbuf = { 0 };
 		char *dname = NULL;
 		bool isdots;
 		char *fname = NULL;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list