Skip to contentSkip to conversation

ocfs2: drop acl cache for directories too

PATCH In review Wengang Wang 3 participants 6 messages Sep 3, 2021 – Sep 20, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ocfs2: drop acl cache for directories too

ocfs2_data_convert_worker() is currently dropping any cached acl info for FILE before down-converting meta lock. It should also drop for DIRECTORY. Otherwise the second acl lookup returns the cached one (from VFS layer) which could be already stale.

The problem we are seeing is that the acl changes on one node doesn't get refreshed on other nodes in the following case:

Node 1 Node 2
-------------- ----------------
getfacl dir1

getfacl dir1 <-- this is OK

setfacl -m u:user1:rwX dir1
getfacl dir1 <-- see the change for user1

getfacl dir1 <-- can't see change for user1

---
 fs/ocfs2/dlmglue.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ocfs2/dlmglue.c +2 -1
index 50a863fc1779..207ec61569ea 100644
@@ -3933,7 +3933,7 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres,
 		oi = OCFS2_I(inode);
 		oi->ip_dir_lock_gen++;
 		mlog(0, "generation: %u\n", oi->ip_dir_lock_gen);
-		goto out;
+		goto out_forget;
 	}
 
 	if (!S_ISREG(inode->i_mode))
@@ -3964,6 +3964,7 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres,
 		filemap_fdatawait(mapping);
 	}
 
+out_forget:
 	forget_all_cached_acls(inode);
 
 out:
Signature · 1 line
2.21.0 (Apple Git-122.2)
maintainer
#1 lore raw
Quoted 48 lines · Wengang Wang

ocfs2_data_convert_worker() is currently dropping any cached acl info for FILE before down-converting meta lock. It should also drop for DIRECTORY. Otherwise the second acl lookup returns the cached one (from VFS layer) which could be already stale.

The problem we are seeing is that the acl changes on one node doesn't get refreshed on other nodes in the following case:

Node 1 Node 2
-------------- ----------------
getfacl dir1

getfacl dir1 <-- this is OK

setfacl -m u:user1:rwX dir1
getfacl dir1 <-- see the change for user1

getfacl dir1 <-- can't see change for user1

---
 fs/ocfs2/dlmglue.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ocfs2/dlmglue.c +2 -1
index 50a863fc1779..207ec61569ea 100644
@@ -3933,7 +3933,7 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres,
 		oi = OCFS2_I(inode);
 		oi->ip_dir_lock_gen++;
 		mlog(0, "generation: %u\n", oi->ip_dir_lock_gen);
-		goto out;
+		goto out_forget;
 	}
 
 	if (!S_ISREG(inode->i_mode))
@@ -3964,6 +3964,7 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres,
 		filemap_fdatawait(mapping);
 	}
 
+out_forget:
 	forget_all_cached_acls(inode);
 
 out:
Signature · 1 line
2.21.0 (Apple Git-122.2)

<formletter>

This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Wengang Wang
Quoted 12 lines · Wengang Wang

ocfs2_data_convert_worker() is currently dropping any cached acl info for FILE before down-converting meta lock. It should also drop for DIRECTORY. Otherwise the second acl lookup returns the cached one (from VFS layer) which could be already stale.

The problem we are seeing is that the acl changes on one node doesn't get refreshed on other nodes in the following case:

Node 1 Node 2
-------------- ----------------
getfacl dir1

Quoted 8 lines

getfacl dir1 <-- this is OK

setfacl -m u:user1:rwX dir1
getfacl dir1 <-- see the change for user1

getfacl dir1 <-- can't see change for user1

Looks sane to me.

Quoted 19 lines
---
 fs/ocfs2/dlmglue.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ocfs2/dlmglue.c +1 -1
index 50a863fc1779..207ec61569ea 100644
@@ -3933,7 +3933,7 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres,
 		oi = OCFS2_I(inode);
 		oi->ip_dir_lock_gen++;
 		mlog(0, "generation: %u\n", oi->ip_dir_lock_gen);
-		goto out;
+		goto out_forget;
 	}
 
 	if (!S_ISREG(inode->i_mode))

fs/ocfs2/dlmglue.c static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres, · line 3970

Quoted 7 lines
fs/ocfs2/dlmglue.c +1 -0
@@ -3964,6 +3964,7 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres,
 		filemap_fdatawait(mapping);
 	}
 
+out_forget:
 	forget_all_cached_acls(inode);
 
 out:

_______________________________________________
Ocfs2-devel mailing list
[email protected]
https://oss.oracle.com/mailman/listinfo/ocfs2-devel

author Reviewed-by Joseph Qi
#3 lore raw

Hi Andrew,

Can you pls merge this patch if it’s not already on the way?

thanks,
wengang

On Sep 6, 2021, at 4:42 AM, Joseph Qi <[email protected]<mailto:[email protected]>> wrote:

On 9/3/21 9:26 AM, Wengang Wang wrote:
ocfs2_data_convert_worker() is currently dropping any cached acl info for FILE before down-converting meta lock. It should also drop for DIRECTORY. Otherwise the second acl lookup returns the cached one (from VFS layer) which could be already stale.

The problem we are seeing is that the acl changes on one node doesn't get refreshed on other nodes in the following case:

Node 1 Node 2
-------------- ----------------
getfacl dir1

getfacl dir1 <-- this is OK

setfacl -m u:user1:rwX dir1
getfacl dir1 <-- see the change for user1

getfacl dir1 <-- can't see change for user1

Looks sane to me.

---
fs/ocfs2/dlmglue.c | 3 ++-

1 file changed, 2 insertions(+), 1 deletion(-)
fs/ocfs2/dlmglue.c +0 -0
index 50a863fc1779..207ec61569ea 100644
@@ -3933,7 +3933,7 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres,

oi = OCFS2_I(inode);
oi->ip_dir_lock_gen++;
mlog(0, "generation: %u\n", oi->ip_dir_lock_gen);
- goto out;
+ goto out_forget;
}

if (!S_ISREG(inode->i_mode))
@@ -3964,6 +3964,7 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres, filemap_fdatawait(mapping);
}

+out_forget:
forget_all_cached_acls(inode);

out:

_______________________________________________
Ocfs2-devel mailing list
[email protected]
https://oss.oracle.com/mailman/listinfo/ocfs2-devel

maintainer
#4 lore raw

It has already been added in -mm tree.

Thanks,
Joseph

Quoted 60 lines · Wengang Wang

Hi Andrew,

Can you pls merge this patch if it’s not already on the way?

thanks,
wengang

On Sep 6, 2021, at 4:42 AM, Joseph Qi <[email protected]<mailto:[email protected]>> wrote:

On 9/3/21 9:26 AM, Wengang Wang wrote:
ocfs2_data_convert_worker() is currently dropping any cached acl info for FILE before down-converting meta lock. It should also drop for DIRECTORY. Otherwise the second acl lookup returns the cached one (from VFS layer) which could be already stale.

The problem we are seeing is that the acl changes on one node doesn't get refreshed on other nodes in the following case:

Node 1 Node 2
-------------- ----------------
getfacl dir1

getfacl dir1 <-- this is OK

setfacl -m u:user1:rwX dir1
getfacl dir1 <-- see the change for user1

getfacl dir1 <-- can't see change for user1

Looks sane to me.

---
fs/ocfs2/dlmglue.c | 3 ++-

1 file changed, 2 insertions(+), 1 deletion(-)
fs/ocfs2/dlmglue.c +2 -1
index 50a863fc1779..207ec61569ea 100644
@@ -3933,7 +3933,7 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres,
 oi = OCFS2_I(inode);
 oi->ip_dir_lock_gen++;
 mlog(0, "generation: %u\n", oi->ip_dir_lock_gen);
- goto out;
+ goto out_forget;
 }
 
 if (!S_ISREG(inode->i_mode))
@@ -3964,6 +3964,7 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres,
 filemap_fdatawait(mapping);
 }
 
+out_forget:
 forget_all_cached_acls(inode);
 
Quoted 2 lines

out:

_______________________________________________
Ocfs2-devel mailing list
[email protected]
https://oss.oracle.com/mailman/listinfo/ocfs2-devel

#5 lore raw
Quoted 5 lines · Joseph Qi

It has already been added in -mm tree.

thanks!
wengang

Quoted 62 lines

Thanks,
Joseph

Quoted 57 lines · Wengang Wang

Hi Andrew,

Can you pls merge this patch if it’s not already on the way?

thanks,
wengang

On Sep 6, 2021, at 4:42 AM, Joseph Qi <[email protected]<mailto:[email protected]>> wrote:

On 9/3/21 9:26 AM, Wengang Wang wrote:
ocfs2_data_convert_worker() is currently dropping any cached acl info for FILE before down-converting meta lock. It should also drop for DIRECTORY. Otherwise the second acl lookup returns the cached one (from VFS layer) which could be already stale.

The problem we are seeing is that the acl changes on one node doesn't get refreshed on other nodes in the following case:

Node 1 Node 2
-------------- ----------------
getfacl dir1

getfacl dir1 <-- this is OK

setfacl -m u:user1:rwX dir1
getfacl dir1 <-- see the change for user1

getfacl dir1 <-- can't see change for user1

Looks sane to me.

---
fs/ocfs2/dlmglue.c | 3 ++-

1 file changed, 2 insertions(+), 1 deletion(-)
fs/ocfs2/dlmglue.c +1 -1
index 50a863fc1779..207ec61569ea 100644
@@ -3933,7 +3933,7 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres,
 oi = OCFS2_I(inode);
 oi->ip_dir_lock_gen++;
 mlog(0, "generation: %u\n", oi->ip_dir_lock_gen);
- goto out;
+ goto out_forget;
 }
 
 if (!S_ISREG(inode->i_mode))
@@ -3964,6 +3964,7 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres,
 filemap_fdatawait(mapping);
 }
 
Quoted 5 lines
Quoted 5 lines
fs/ocfs2/dlmglue.c +1 -0
+out_forget:
 forget_all_cached_acls(inode);
 

out:

_______________________________________________
Ocfs2-devel mailing list
[email protected]
https://oss.oracle.com/mailman/listinfo/ocfs2-devel