liburing icon indicating copy to clipboard operation
liburing copied to clipboard

File shared/exclusive lock/unlock

Open YoSTEALTH opened this issue 5 years ago • 10 comments

I am adding this here to keep track of this topic.

If we could have functions like io_uring_prep_lock() and io_uring_prep_unlock() for file locking/unlocking using something like IOSQE_IO_LINK to join few sequence together.

It would really be nice if this can be in Linux 5.6 :)

YoSTEALTH avatar Feb 24 '20 21:02 YoSTEALTH

5.6 is feature locked at this point, and not sure I'll have time to work on this for 5.7. So 5.8 is a more realistic target, I'm afraid.

axboe avatar Feb 24 '20 22:02 axboe

Locking and unlocking is very important part of the project i wanted to use Liburing in :(

YoSTEALTH avatar Feb 24 '20 22:02 YoSTEALTH

Sorry, there's really nothing I can do, 5.6 is totally closed, it's bug fixes only after the merge window. And I've got other items I'm working on, hence I'm not going to promise anything for 5.7. Just trying to manage your expectations.

axboe avatar Feb 24 '20 23:02 axboe

No worries... I will just have to rig a temp fix for now :)

YoSTEALTH avatar Feb 25 '20 20:02 YoSTEALTH

Locking/unlocking and directory contents listing (getdents64 https://github.com/axboe/liburing/issues/111) is the first wave an totally uring drived io app will meet.

openalmeida avatar Dec 31 '20 08:12 openalmeida

@axboe if I was to try and implement flock support in io_uring, where should I look? Blocking the worker thread is a bad idea, so we probably need to somehow do a callback on lock acquisition instead. I suspect this is not possible at the moment and going to require quite a lot of quite involved work and I should stay away from it given my very limited kernel development experience? :)

dkadashev avatar Jun 04 '21 08:06 dkadashev

flock is fd lock vs pid lock (commonly used). This could easily be used if fcntl was implemented https://github.com/axboe/liburing/issues/199 Its a chain of dependencies :)

Lock is only a lock as long as other software in your system also use the same method

YoSTEALTH avatar Jun 04 '21 08:06 YoSTEALTH

I am adding this here to keep track of this topic.

If we could have functions like io_uring_prep_lock() and io_uring_prep_unlock() for file locking/unlocking using something like IOSQE_IO_LINK to join few sequence together.

It would really be nice if this can be in Linux 5.6 :)

are sucess exclusive unlock script ? you run own web ?

imanthaashan77 avatar Dec 12 '21 12:12 imanthaashan77

@imanthaashan77

are sucess exclusive unlock script ?

I am not sure what you are asking! None the less... I am currently using an atomic counter to reserve space, this way no external fd/pid lock/unlock system needs to be used, also its much faster, of course this is only viable within the software. External process can still alter the file.

you run own web ?

Lock/unlock is for file write not for web use.

YoSTEALTH avatar Jan 14 '22 21:01 YoSTEALTH

Any way we can help with this?

ioquatix avatar Aug 29 '23 09:08 ioquatix