diff options
| author | M. Mohan Kumar <mohan@in.ibm.com> | 2010-09-27 02:04:24 -0400 |
|---|---|---|
| committer | Eric Van Hensbergen <ericvh@gmail.com> | 2010-10-28 10:08:47 -0400 |
| commit | a099027c779068b834f335cfdc3f2bf10f531dd9 (patch) | |
| tree | eee43443cce85a03c13b1cfdd25bf451445cf78f /include/net | |
| parent | 920e65dc6911da28a58e17f4b683302636fc6d8e (diff) | |
9p: Implement TLOCK
Synopsis
size[4] TLock tag[2] fid[4] flock[n]
size[4] RLock tag[2] status[1]
Description
Tlock is used to acquire/release byte range posix locks on a file
identified by given fid. The reply contains status of the lock request
flock structure:
type[1] - Type of lock: F_RDLCK, F_WRLCK, F_UNLCK
flags[4] - Flags could be either of
P9_LOCK_FLAGS_BLOCK - Blocked lock request, if there is a
conflicting lock exists, wait for that lock to be released.
P9_LOCK_FLAGS_RECLAIM - Reclaim lock request, used when client is
trying to reclaim a lock after a server restrart (due to crash)
start[8] - Starting offset for lock
length[8] - Number of bytes to lock
If length is 0, lock all bytes starting at the location 'start'
through to the end of file
pid[4] - PID of the process that wants to take lock
client_id[4] - Unique client id
status[1] - Status of the lock request, can be
P9_LOCK_SUCCESS(0), P9_LOCK_BLOCKED(1), P9_LOCK_ERROR(2) or
P9_LOCK_GRACE(3)
P9_LOCK_SUCCESS - Request was successful
P9_LOCK_BLOCKED - A conflicting lock is held by another process
P9_LOCK_ERROR - Error while processing the lock request
P9_LOCK_GRACE - Server is in grace period, it can't accept new lock
requests in this period (except locks with
P9_LOCK_FLAGS_RECLAIM flag set)
Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'include/net')
| -rw-r--r-- | include/net/9p/9p.h | 28 | ||||
| -rw-r--r-- | include/net/9p/client.h | 1 |
2 files changed, 29 insertions, 0 deletions
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h index 55e96057f47f..1859a2560cc5 100644 --- a/include/net/9p/9p.h +++ b/include/net/9p/9p.h | |||
| @@ -165,6 +165,8 @@ enum p9_msg_t { | |||
| 165 | P9_RREADDIR, | 165 | P9_RREADDIR, |
| 166 | P9_TFSYNC = 50, | 166 | P9_TFSYNC = 50, |
| 167 | P9_RFSYNC, | 167 | P9_RFSYNC, |
| 168 | P9_TLOCK = 52, | ||
| 169 | P9_RLOCK, | ||
| 168 | P9_TLINK = 70, | 170 | P9_TLINK = 70, |
| 169 | P9_RLINK, | 171 | P9_RLINK, |
| 170 | P9_TMKDIR = 72, | 172 | P9_TMKDIR = 72, |
| @@ -464,6 +466,32 @@ struct p9_iattr_dotl { | |||
| 464 | u64 mtime_nsec; | 466 | u64 mtime_nsec; |
| 465 | }; | 467 | }; |
| 466 | 468 | ||
| 469 | #define P9_LOCK_SUCCESS 0 | ||
| 470 | #define P9_LOCK_BLOCKED 1 | ||
| 471 | #define P9_LOCK_ERROR 2 | ||
| 472 | #define P9_LOCK_GRACE 3 | ||
| 473 | |||
| 474 | #define P9_LOCK_FLAGS_BLOCK 1 | ||
| 475 | #define P9_LOCK_FLAGS_RECLAIM 2 | ||
| 476 | |||
| 477 | /* struct p9_flock: POSIX lock structure | ||
| 478 | * @type - type of lock | ||
| 479 | * @flags - lock flags | ||
| 480 | * @start - starting offset of the lock | ||
| 481 | * @length - number of bytes | ||
| 482 | * @proc_id - process id which wants to take lock | ||
| 483 | * @client_id - client id | ||
| 484 | */ | ||
| 485 | |||
| 486 | struct p9_flock { | ||
| 487 | u8 type; | ||
| 488 | u32 flags; | ||
| 489 | u64 start; | ||
| 490 | u64 length; | ||
| 491 | u32 proc_id; | ||
| 492 | char *client_id; | ||
| 493 | }; | ||
| 494 | |||
| 467 | /* Structures for Protocol Operations */ | 495 | /* Structures for Protocol Operations */ |
| 468 | struct p9_tstatfs { | 496 | struct p9_tstatfs { |
| 469 | u32 fid; | 497 | u32 fid; |
diff --git a/include/net/9p/client.h b/include/net/9p/client.h index 8744e3ad4a07..d7dcb142e3bb 100644 --- a/include/net/9p/client.h +++ b/include/net/9p/client.h | |||
| @@ -249,6 +249,7 @@ int p9_client_mknod_dotl(struct p9_fid *oldfid, char *name, int mode, | |||
| 249 | dev_t rdev, gid_t gid, struct p9_qid *); | 249 | dev_t rdev, gid_t gid, struct p9_qid *); |
| 250 | int p9_client_mkdir_dotl(struct p9_fid *fid, char *name, int mode, | 250 | int p9_client_mkdir_dotl(struct p9_fid *fid, char *name, int mode, |
| 251 | gid_t gid, struct p9_qid *); | 251 | gid_t gid, struct p9_qid *); |
| 252 | int p9_client_lock_dotl(struct p9_fid *fid, struct p9_flock *flock, u8 *status); | ||
| 252 | struct p9_req_t *p9_tag_lookup(struct p9_client *, u16); | 253 | struct p9_req_t *p9_tag_lookup(struct p9_client *, u16); |
| 253 | void p9_client_cb(struct p9_client *c, struct p9_req_t *req); | 254 | void p9_client_cb(struct p9_client *c, struct p9_req_t *req); |
| 254 | 255 | ||
