[LU-12380] Allow reusing of write openhandle for reads Created: 04/Jun/19  Updated: 10/Jun/19

Status: Open
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.13.0
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: Oleg Drokin Assignee: WC Triage
Resolution: Unresolved Votes: 0
Labels: None

Rank (Obsolete): 9223372036854775807

 Description   

Currently when openlock cahe is used we distinguish 3 kinds of opens: WRITE, READ and EXEC. the O_RDWR mode is counted as WRITE.

READ mode is compatible with either EXEC or WRITE, but EXEC and WRITE are incompatible between themselves.

Give that there's a relatively common workload of open file for write ; write into file ; close ; open file for read.; read ; close is typical - it's an interesting idea to combine WRITE and READ handles at least somewhat.

In absence of EXEC mode they are pretty much the same (when obtained in WRITE ; READ order). Exec of course makes it somewhat tricky since as long as we hold the write lock, we cannot do open for exec.

Possible idea to tackle this:
When we have the WRITE openlock (and handle) and we want to open it for READ we can just detect the CW lock (guaranteeing the file did not get anywhere as well - important from correctness perspective!) and reuse the handle.

Should we get a blocking ast on the CW lock (or perhaps even before? or as a lock/mode convert downgrade op (obviously it's a protocol change so more involved)?) - we would first send and acquire a read handle (and lock) and then release the CW lock and WRITE handle allowing us continuity in operations.



 Comments   
Comment by Gerrit Updater [ 04/Jun/19 ]

Oleg Drokin (green@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/35054
Subject: LU-12380 llite: Allow reusing write openhandle for reads from same node
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: aa731640ed6f780a284e2626874c7c910a1a0de6

Comment by Oleg Drokin [ 10/Jun/19 ]

I've noticed there's a fairly low hanging fruit for DoM possible wrt open locks.

If we issue a PW DoM lock already and piggy back open bit on that - the above description works even better with less possible breakage.

This is esp. nice in conjunction with LU-12325 where initial open only happens for PR lock but only if we have writes - we get a separate DoM PW lock only when we write to the file. We then can avoid the read open MDS roundtrip and get all reads fully locally under the same PW lock.

Shows real nice results in testing.

Comment by Gerrit Updater [ 10/Jun/19 ]

Oleg Drokin (green@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/35146
Subject: LU-12380 llite/mds: WIP! piggy back open handle on DoM PW lock
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: fccf51448389b5db202adf184dafa34579c7b358

Comment by Gerrit Updater [ 10/Jun/19 ]

Oleg Drokin (green@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/35147
Subject: LU-12380 llite: WIP Allow open lock converting.
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: c0f1e5bb557ed07e0c7a3d49e8026eba127591fe

Generated at Sat Feb 10 02:52:04 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.