The file_lock->fl_break_notified field will be used when checkpointing and
restarting a file-lease. It is needed if the application was checkpointed
during the lease-break-protocol, to "remember" if the application was notified
of the lease-break.

This patch just initializes the ->fl_break_notified field. It will be used
in a follow-on patch, when checkpoint/restart of file-leases are implemented.

Signed-off-by: Sukadev Bhattiprolu <[email protected]>
---
 fs/locks.c         |    7 +++++++
 include/linux/fs.h |    1 +
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 9a00876..b5eb4c0 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -185,6 +185,7 @@ void locks_init_lock(struct file_lock *fl)
        fl->fl_flags = 0;
        fl->fl_type = 0;
        fl->fl_type_prev = 0;
+       fl->fl_break_notified = 0;
        fl->fl_start = fl->fl_end = 0;
        fl->fl_break_time = 0UL;
        fl->fl_ops = NULL;
@@ -230,6 +231,7 @@ void __locks_copy_lock(struct file_lock *new, const struct 
file_lock *fl)
        new->fl_type = fl->fl_type;
        new->fl_type_prev = fl->fl_type_prev;
        new->fl_start = fl->fl_start;
+       new->fl_break_notified = fl->fl_break_notified;
        new->fl_end = fl->fl_end;
        new->fl_break_time = 0UL;
        new->fl_ops = NULL;
@@ -458,6 +460,7 @@ static int lease_init(struct file *filp, int type, struct 
file_lock *fl)
 
        fl->fl_file = filp;
        fl->fl_flags = FL_LEASE;
+       fl->fl_break_notified = 0;
        fl->fl_start = 0;
        fl->fl_end = OFFSET_MAX;
        fl->fl_ops = NULL;
@@ -1141,6 +1144,8 @@ int lease_modify(struct file_lock **before, int arg)
        struct file_lock *fl = *before;
        int error = assign_type(fl, arg);
 
+       fl->fl_break_notified = 0;
+
        if (error)
                return error;
        locks_wake_up_blocks(fl);
@@ -1234,8 +1239,10 @@ int __break_lease(struct inode *inode, unsigned int mode)
                        fl->fl_type_prev = fl->fl_type;
                        fl->fl_type = future;
                        fl->fl_break_time = break_time;
+
                        /* lease must have lmops break callback */
                        fl->fl_lmops->fl_break(fl);
+                       fl->fl_break_notified = 1;
                }
        }
 
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 299cc09..c21f002 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1067,6 +1067,7 @@ struct file_lock {
        unsigned char fl_flags;
        unsigned char fl_type;
        unsigned char fl_type_prev;
+       unsigned char fl_break_notified;
        unsigned int fl_pid;
        struct pid *fl_nspid;
        wait_queue_head_t fl_wait;
-- 
1.6.0.4

_______________________________________________
Containers mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/containers

_______________________________________________
Devel mailing list
[email protected]
https://openvz.org/mailman/listinfo/devel

Reply via email to