RE: [PATCH 10/11] nfsd: make deny mode enforcement more efficient and close races in it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> The current enforcement of deny modes is both inefficient and scattered
> across several places, which makes it hard to guarantee atomicity. The
> inefficiency is a problem now, and the lack of atomicity will mean races
once
> the client_mutex is removed.
> 
> First, we address the inefficiency. We have to track deny modes on a per-
> stateid basis to ensure that open downgrades are sane, but when the server
> goes to enforce them it has to walk the entire list of stateids and check
> against each one.
> 
> Instead of doing that, maintain a per-nfs4_file deny mode. When a file is
> opened, we simply set any deny bits in that mode that were specified in
the
> OPEN call. We can then use that unified deny mode to do a simple check to
> see whether there are any conflicts without needing to walk the entire
> stateid list.
> 
> The only time we'll need to walk the entire list of stateids is when a
stateid
> that has a deny mode on it is being released, or one is having its deny
mode
> downgraded. In that case, we must walk the entire list and recalculate the
> fi_share_deny field. Since deny modes are pretty rare today, this should
be
> very rare under normal workloads.

What we do in Ganesha to avoid walking the list of stateids on release is
maintain the effective deny (and access) mode not at bits, but as a counter
for each bit. Thus, to remove a SHARE_ACCESS_READ | SHARE_DENY_WRITE, you
decrement the counts for access_read and deny_write.

Frank


--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux