[Stable Update] 2020-05-08 - Samba Server instabil

Hallo,

Seit dem Update kann keine Stabile Verbindung mehr von Windows 10 1909 auf drei Samba Shares gehalten werden.

  • Vor dem Update lief alles seit Jahren fehlerfrei.
  • An der smb.conf wurde zuletzt vor zwei Jahren etwas geändert.
  • Es kann von Win10 eine Verbindung über "Netzlaufwerk Verbinden" hergestellt werden.
  • Der LW-Buchstabe kann angewählt werden. Ordner sind zu sehen, können aber nicht geöffnet werden.
  • Der lokale Zugriff ist ohne Probleme möglich.

Es wird sehr oft die Meldung "Das Handle ist ungültig" ausgegeben.
Seltsam ist, das ich eine Datei anlegen kann, diese aber anschließend Schreib- und Zugriffs-geschützt ist, da sie angeblich in Verwendung sei. > Lokaler Zugriff kein Problem.
Noch seltsamer ist, das ein SeaMonkey Profil, das auf dem Netzlw liegt vom Programm einwandfrei angesteuert werden kann.

Was hat sich seit dem letzten SAMBA Update geändert, das dieses seltsame Verhalten auftritt?

DK3

There is literally dozens of topics on Samba and yes there is problems.

The latest issue is upstream disable of the insecure SMB1 protocol which creates issues for many users using their router to share an USB device.

If you have the choice the use NFS. NFS is superior to a reverse engineered proprietary Microsoft protocol and NFS is supported by Windows.


Übersetzung mit Google

Es gibt buchstäblich Dutzende von Themen auf Samba und ja, es gibt Probleme.

Das neueste Problem ist die vorgelagerte Deaktivierung des unsicheren SMB1-Protokolls, wodurch viele Benutzer Probleme haben, wenn sie ihren Router verwenden, um ein USB-Gerät gemeinsam zu nutzen.

Wenn Sie die Wahl haben, verwenden Sie NFS. NFS ist einem rückentwickelten proprietären Microsoft-Protokoll überlegen, und NFS wird von Windows unterstützt.

SMB1 ist seit der Installation des Systems abgeschaltet.
Der Zugriff erfolgt von vier Personen und insgesamt 12 Systemen mit Win7, Win8.1 und Win10.
Sechs der Systeme sind VirtualBox Maschinen. Für Win7 und Win8.1 existieren die Netzlaufwerke gar nicht mehr.

NFS ist für die anderen 11 Manjaro Maschinen aktiv und funktioniert einwandfrei.

Die freie Wahl ob SMB oder NFS für die Windows Installationen habe ich leider nicht bei allen Geräten.

DK3

Laut einigen Berichten hat die Samba 4.12.x Reihe eine Menge Probleme mit Windows Clients.
Ist es Möglich das Paket general auf 4.11x zurück zu stufen und dabei zu bleiben bis 4.13.x erschienen ist?

Link: https://www.spinics.net/lists/samba/msg163630.html

DK3

Most likely it is fixed by reverting this patch:

On Sat, 2020-05-09 at 06:08 +0200, pavlos wrote:
Hi All,

It's already 6am at my side. After the whole night of bisecting, compiling and testing I think I have nailed it:

fd61e550acec6e9924a71712eef739b58c7d68e8 is the first bad commit
commit fd61e550acec6e9924a71712eef739b58c7d68e8
Author: Volker Lendecke vl@xxxxxxxxx
Date: Mon Sep 16 16:16:40 2019 -0700

smbd: Don't always walk the share mode array in open_mode_check()

share_mode_data->flags contains the "most restrictive" share mode of
the whole array. This is maintained lazily: Whenever set_share_mode()
is called, d->flags is updated if the new share mode got more
restrictive. It is not updated when a file is closed, as this would
mean we would have to walk the whole array, making sure that the
closed handle was indeed the only most restrictive one. Instead, we
walk the share mode array only when a conflict happens: Then we need
to know "the truth" and recalculate it by walking the share mode
array.

Signed-off-by: Volker Lendecke <vl@xxxxxxxxx>
Reviewed-by: Jeremy Allison <jra@xxxxxxxxx>

Autobuild-User(master): Jeremy Allison <jra@xxxxxxxxx>
Autobuild-Date(master): Wed Sep 18 00:07:13 UTC 2019 on sn-devel-184

source3/smbd/open.c | 217 ++++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 200 insertions(+), 17 deletions(-)

Why do I think so?
Because:
I did a reset my current Samba master - my last clone was about 10 hours ago.
It is version 4.13.0pre1-GIT-e907f002a7f
Then I have carefuly edited the file 'source3/smbd/open.c' and withdrawn all changes
Saved, compiled, installed, started services, tested different scenarios and it works PROPERLY.
For the first time in any version greater that 4.11
Yes, it's magic :slight_smile:

Please, be so kind and check - everybody who suffers this bug, and, of course, the author of this change - and let me know whether my night was worth spending in front of my computer.

Looking forward to hearing from you.
Pawel.

Nicht ohne Samba 4.11 selbst zu kompilieren. Du kannst dir das letzte Samba 4.11 PKGBUILD und alle dazugehörigen Dateien herunterladen und es selbst gegen die neueren Bibliotheken bauen.

https://git.archlinux.org/svntogit/packages.git/log/trunk?h=packages/samba

Es kann sein, dass du Pakete die von Samba anhängig sind auch gegen deine alte Samba Version neu kompilieren musst. Das wirst du aber recht schnell herausfinden.

Dann kann es Sinnvoll sein die Samba Pakte zur IgnorePkg Liste von pacman hinzuzufügen. Dadurch wird pacman die Pakte nicht aktualisieren.

Sollte es bei einer von Samba benötigten Bibliothek zu einer Versionsänderung kommen, wirst du wahrscheinlich Samba neu kompilieren müssen.

--- a/source3/smbd/open.c	2020-02-28 09:59:35.000000000 +0100
+++ b/source3/smbd/open.c	2020-05-10 12:39:30.115201516 +0200
@@ -1648,112 +1648,6 @@ static bool has_delete_on_close(struct s
 	return state.ret;
 }
 
-static void share_mode_flags_get(
-	uint16_t flags,
-	uint32_t *access_mask,
-	uint32_t *share_mode,
-	uint32_t *lease_type)
-{
-	if (access_mask != NULL) {
-		*access_mask =
-			((flags & SHARE_MODE_ACCESS_READ) ?
-			 FILE_READ_DATA : 0) |
-			((flags & SHARE_MODE_ACCESS_WRITE) ?
-			 FILE_WRITE_DATA : 0) |
-			((flags & SHARE_MODE_ACCESS_DELETE) ?
-			 DELETE_ACCESS : 0);
-	}
-	if (share_mode != NULL) {
-		*share_mode =
-			((flags & SHARE_MODE_SHARE_READ) ?
-			 FILE_SHARE_READ : 0) |
-			((flags & SHARE_MODE_SHARE_WRITE) ?
-			 FILE_SHARE_WRITE : 0) |
-			((flags & SHARE_MODE_SHARE_DELETE) ?
-			 FILE_SHARE_DELETE : 0);
-	}
-	if (lease_type != NULL) {
-		*lease_type =
-			((flags & SHARE_MODE_LEASE_READ) ?
-			 SMB2_LEASE_READ : 0) |
-			((flags & SHARE_MODE_LEASE_WRITE) ?
-			 SMB2_LEASE_WRITE : 0) |
-			((flags & SHARE_MODE_LEASE_HANDLE) ?
-			 SMB2_LEASE_HANDLE : 0);
-	}
-}
-
-static uint16_t share_mode_flags_set(
-	uint16_t flags,
-	uint32_t access_mask,
-	uint32_t share_mode,
-	uint32_t lease_type)
-{
-	if (access_mask != UINT32_MAX) {
-		flags &= ~(SHARE_MODE_ACCESS_READ|
-			   SHARE_MODE_ACCESS_WRITE|
-			   SHARE_MODE_ACCESS_DELETE);
-		flags |= (access_mask & (FILE_READ_DATA | FILE_EXECUTE)) ?
-			SHARE_MODE_ACCESS_READ : 0;
-		flags |= (access_mask & (FILE_WRITE_DATA | FILE_APPEND_DATA)) ?
-			SHARE_MODE_ACCESS_WRITE : 0;
-		flags |= (access_mask & (DELETE_ACCESS)) ?
-			SHARE_MODE_ACCESS_DELETE : 0;
-	}
-	if (share_mode != UINT32_MAX) {
-		flags &= ~(SHARE_MODE_SHARE_READ|
-			   SHARE_MODE_SHARE_WRITE|
-			   SHARE_MODE_SHARE_DELETE);
-		flags |= (share_mode & FILE_SHARE_READ) ?
-			SHARE_MODE_SHARE_READ : 0;
-		flags |= (share_mode & FILE_SHARE_WRITE) ?
-			SHARE_MODE_SHARE_WRITE : 0;
-		flags |= (share_mode & FILE_SHARE_DELETE) ?
-			SHARE_MODE_SHARE_DELETE : 0;
-	}
-	if (lease_type != UINT32_MAX) {
-		flags &= ~(SHARE_MODE_LEASE_READ|
-			   SHARE_MODE_LEASE_WRITE|
-			   SHARE_MODE_LEASE_HANDLE);
-		flags |= (lease_type & SMB2_LEASE_READ) ?
-			SHARE_MODE_LEASE_READ : 0;
-		flags |= (lease_type & SMB2_LEASE_WRITE) ?
-			SHARE_MODE_LEASE_WRITE : 0;
-		flags |= (lease_type & SMB2_LEASE_HANDLE) ?
-			SHARE_MODE_LEASE_HANDLE : 0;
-	}
-
-	return flags;
-}
-
-static uint16_t share_mode_flags_restrict(
-	uint16_t flags,
-	uint32_t access_mask,
-	uint32_t share_mode,
-	uint32_t lease_type)
-{
-	uint32_t existing_access_mask, existing_share_mode;
-	uint32_t existing_lease_type;
-	uint16_t ret;
-
-	share_mode_flags_get(
-		flags,
-		&existing_access_mask,
-		&existing_share_mode,
-		&existing_lease_type);
-
-	existing_access_mask |= access_mask;
-	existing_share_mode &= share_mode;
-	existing_lease_type |= lease_type;
-
-	ret = share_mode_flags_set(
-		flags,
-		existing_access_mask,
-		existing_share_mode,
-		existing_lease_type);
-	return ret;
-}
-
 /****************************************************************************
  Deal with share modes
  Invariant: Share mode must be locked on entry and exit.
@@ -1761,10 +1655,9 @@ static uint16_t share_mode_flags_restric
 ****************************************************************************/
 
 struct open_mode_check_state {
-	struct file_id fid;
 	uint32_t access_mask;
 	uint32_t share_access;
-	uint32_t lease_type;
+	bool conflict;
 };
 
 static bool open_mode_check_fn(
@@ -1773,34 +1666,28 @@ static bool open_mode_check_fn(
 	void *private_data)
 {
 	struct open_mode_check_state *state = private_data;
-	bool disconnected, stale;
-	uint32_t access_mask, share_access, lease_type;
+	bool disconnected, conflict, stale;
 
 	disconnected = server_id_is_disconnected(&e->pid);
 	if (disconnected) {
 		return false;
 	}
 
-	access_mask = state->access_mask | e->access_mask;
-	share_access = state->share_access & e->share_access;
-	lease_type = state->lease_type | get_lease_type(e, state->fid);
-
-	if ((access_mask == state->access_mask) &&
-	    (share_access == state->share_access) &&
-	    (lease_type == state->lease_type)) {
+	conflict = share_conflict(
+		e->access_mask,
+		e->share_access,
+		state->access_mask,
+		state->share_access);
+	if (!conflict) {
 		return false;
 	}
-
 	stale = share_entry_stale_pid(e);
 	if (stale) {
 		return false;
 	}
 
-	state->access_mask = access_mask;
-	state->share_access = share_access;
-	state->lease_type = lease_type;
-
-	return false;
+	state->conflict = true;
+	return true;
 }
 
 static NTSTATUS open_mode_check(connection_struct *conn,
@@ -1808,10 +1695,10 @@ static NTSTATUS open_mode_check(connecti
 				uint32_t access_mask,
 				uint32_t share_access)
 {
-	struct share_mode_data *d = lck->data;
-	struct open_mode_check_state state;
-	uint16_t new_flags;
-	bool ok, conflict, have_share_entries;
+	struct open_mode_check_state state = {
+		.access_mask = access_mask, .share_access = share_access,
+	};
+	bool ok;
 
 	if (is_stat_open(access_mask)) {
 		/* Stat open that doesn't trigger oplock breaks or share mode
@@ -1827,7 +1714,7 @@ static NTSTATUS open_mode_check(connecti
 	{
 		struct validate_my_share_entries_state validate_state = {
 			.sconn = conn->sconn,
-			.fid = d->id,
+			.fid = lck->data->id,
 			.self = messaging_server_id(conn->sconn->msg_ctx),
 		};
 		ok = share_mode_forall_entries(
@@ -1836,69 +1723,17 @@ static NTSTATUS open_mode_check(connecti
 	}
 #endif
 
-	have_share_entries = share_mode_have_entries(lck);
-	if (!have_share_entries) {
-		/*
-		 * This is a fresh share mode lock where no conflicts
-		 * can happen.
-		 */
-		return NT_STATUS_OK;
-	}
-
-	share_mode_flags_get(
-		d->flags, &state.access_mask, &state.share_access, NULL);
-
-	conflict = share_conflict(
-		state.access_mask,
-		state.share_access,
-		access_mask,
-		share_access);
-	if (!conflict) {
-		DBG_DEBUG("No conflict due to share_mode_flags access\n");
-		return NT_STATUS_OK;
-	}
-
-	state = (struct open_mode_check_state) {
-		.fid = d->id,
-		.share_access = (FILE_SHARE_READ|
-				 FILE_SHARE_WRITE|
-				 FILE_SHARE_DELETE),
-	};
-
-	/*
-	 * Walk the share mode array to recalculate d->flags
-	 */
-
 	ok = share_mode_forall_entries(lck, open_mode_check_fn, &state);
 	if (!ok) {
 		DBG_DEBUG("share_mode_forall_entries failed\n");
 		return NT_STATUS_INTERNAL_ERROR;
 	}
 
-	new_flags = share_mode_flags_set(
-		0, state.access_mask, state.share_access, state.lease_type);
-	if (new_flags == d->flags) {
-		/*
-		 * We only end up here if we had a sharing violation
-		 * from d->flags and have recalculated it.
-		 */
+	if (state.conflict) {
 		return NT_STATUS_SHARING_VIOLATION;
 	}
 
-	d->flags = new_flags;
-	d->modified = true;
-
-	conflict = share_conflict(
-		state.access_mask,
-		state.share_access,
-		access_mask,
-		share_access);
-	if (!conflict) {
-		DBG_DEBUG("No conflict due to share_mode_flags access\n");
-		return NT_STATUS_OK;
-	}
-
-	return NT_STATUS_SHARING_VIOLATION;
+	return NT_STATUS_OK;
 }
 
 /*
@@ -3814,17 +3649,6 @@ static NTSTATUS open_file_ntcreate(conne
 		return status;
 	}
 
-	{
-		struct share_mode_data *d = lck->data;
-		uint16_t new_flags = share_mode_flags_restrict(
-			d->flags, access_mask, share_access, UINT32_MAX);
-
-		if (new_flags != d->flags) {
-			d->flags = new_flags;
-			d->modified = true;
-		}
-	}
-
 	ok = set_share_mode(
 		lck,
 		fsp,
@@ -4501,17 +4325,6 @@ static NTSTATUS open_directory(connectio
 		return status;
 	}
 
-	{
-		struct share_mode_data *d = lck->data;
-		uint16_t new_flags = share_mode_flags_restrict(
-			d->flags, access_mask, share_access, UINT32_MAX);
-
-		if (new_flags != d->flags) {
-			d->flags = new_flags;
-			d->modified = true;
-		}
-	}
-
 	ok = set_share_mode(
 		lck,
 		fsp,

Try if this release fixes your issue: https://sourceforge.net/projects/manjarodev/files/users/philm/samba/

1 Like

Habe die beiden Pakete installiert, neu gestartet und es läuft wieder wie gewohnt.

Vielen Dank!

DK3

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by