s3:share_mode_lock: let share_mode_forall_entries/share_entry_forall evaluate e.stale...
authorStefan Metzmacher <metze@samba.org>
Fri, 28 Aug 2020 13:56:35 +0000 (15:56 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 3 Sep 2020 13:34:11 +0000 (13:34 +0000)
It's not really clear why e.stale would be ignored if *modified is set
to true.

This matches the behavior of share_mode_entry_do()

This also makes sure we see the removed entry in level 10 logs again.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14428

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit deb2f782c95a5e59a0a5da4272239c2d31bc2b6d)

source3/locking/share_mode_lock.c

index ca8b2f4752900cb2745ee8362e36c9d387c7c8b6..0c5626f4bd1b87378e6fe9a19e864aee82623bba 100644 (file)
@@ -2022,6 +2022,18 @@ static bool share_mode_for_one_entry(
                  (int)modified,
                  (int)e.stale);
 
+       if (e.stale) {
+               if (*i < *num_share_modes) {
+                       memmove(blob.data,
+                               blob.data + SHARE_MODE_ENTRY_SIZE,
+                               (*num_share_modes - *i - 1) *
+                               SHARE_MODE_ENTRY_SIZE);
+               }
+               *num_share_modes -= 1;
+               *writeback = true;
+               return stop;
+       }
+
        if (modified) {
                if (DEBUGLEVEL>=10) {
                        DBG_DEBUG("share_mode_entry:\n");
@@ -2052,18 +2064,6 @@ static bool share_mode_for_one_entry(
                return stop;
        }
 
-       if (e.stale) {
-               if (*i < *num_share_modes) {
-                       memmove(blob.data,
-                               blob.data + SHARE_MODE_ENTRY_SIZE,
-                               (*num_share_modes - *i - 1) *
-                               SHARE_MODE_ENTRY_SIZE);
-               }
-               *num_share_modes -= 1;
-               *writeback = true;
-               return stop;
-       }
-
        if (stop) {
                return true;
        }