X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=fs%2Flocks.c;h=43c0af21a0c5fb563ceb12073d085e5ed45e2ddf;hb=170e19ab2900b7c959d7a0e627fd12f383efcfa1;hp=49354b9c7dc1234779a7c21114e0c976d12e7e1d;hpb=8976b6fd7a0060f72e20d5cec833c03d50874cd1;p=firefly-linux-kernel-4.4.55.git diff --git a/fs/locks.c b/fs/locks.c index 49354b9c7dc1..43c0af21a0c5 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -658,8 +658,7 @@ posix_test_lock(struct file *filp, struct file_lock *fl) if (cfl) { __locks_copy_lock(fl, cfl); if (cfl->fl_nspid) - fl->fl_pid = pid_nr_ns(cfl->fl_nspid, - task_active_pid_ns(current)); + fl->fl_pid = pid_vnr(cfl->fl_nspid); } else fl->fl_type = F_UNLCK; unlock_kernel(); @@ -1276,13 +1275,13 @@ out: EXPORT_SYMBOL(__break_lease); /** - * lease_get_mtime + * lease_get_mtime - get the last modified time of an inode * @inode: the inode * @time: pointer to a timespec which will contain the last modified time * * This is to force NFS clients to flush their caches for files with * exclusive leases. The justification is that if someone has an - * exclusive lease, then they could be modifiying it. + * exclusive lease, then they could be modifying it. */ void lease_get_mtime(struct inode *inode, struct timespec *time) { @@ -1802,17 +1801,21 @@ again: if (error) goto out; - for (;;) { - error = vfs_lock_file(filp, cmd, file_lock, NULL); - if (error != -EAGAIN || cmd == F_SETLK) - break; - error = wait_event_interruptible(file_lock->fl_wait, - !file_lock->fl_next); - if (!error) - continue; + if (filp->f_op && filp->f_op->lock != NULL) + error = filp->f_op->lock(filp, cmd, file_lock); + else { + for (;;) { + error = posix_lock_file(filp, file_lock, NULL); + if (error != -EAGAIN || cmd == F_SETLK) + break; + error = wait_event_interruptible(file_lock->fl_wait, + !file_lock->fl_next); + if (!error) + continue; - locks_delete_block(file_lock); - break; + locks_delete_block(file_lock); + break; + } } /* @@ -1926,17 +1929,21 @@ again: if (error) goto out; - for (;;) { - error = vfs_lock_file(filp, cmd, file_lock, NULL); - if (error != -EAGAIN || cmd == F_SETLK64) - break; - error = wait_event_interruptible(file_lock->fl_wait, - !file_lock->fl_next); - if (!error) - continue; + if (filp->f_op && filp->f_op->lock != NULL) + error = filp->f_op->lock(filp, cmd, file_lock); + else { + for (;;) { + error = posix_lock_file(filp, file_lock, NULL); + if (error != -EAGAIN || cmd == F_SETLK64) + break; + error = wait_event_interruptible(file_lock->fl_wait, + !file_lock->fl_next); + if (!error) + continue; - locks_delete_block(file_lock); - break; + locks_delete_block(file_lock); + break; + } } /* @@ -2084,7 +2091,7 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl, unsigned int fl_pid; if (fl->fl_nspid) - fl_pid = pid_nr_ns(fl->fl_nspid, task_active_pid_ns(current)); + fl_pid = pid_vnr(fl->fl_nspid); else fl_pid = fl->fl_pid;