nlmsvc_cancel_blocked(net, file, lock);
 
        lock->fl.fl_type = F_UNLCK;
-       if (file->f_file[O_RDONLY])
-               error = vfs_lock_file(file->f_file[O_RDONLY], F_SETLK,
+       lock->fl.fl_file = file->f_file[O_RDONLY];
+       if (lock->fl.fl_file)
+               error = vfs_lock_file(lock->fl.fl_file, F_SETLK,
                                        &lock->fl, NULL);
-       if (file->f_file[O_WRONLY])
-               error = vfs_lock_file(file->f_file[O_WRONLY], F_SETLK,
+       lock->fl.fl_file = file->f_file[O_WRONLY];
+       if (lock->fl.fl_file)
+               error |= vfs_lock_file(lock->fl.fl_file, F_SETLK,
                                        &lock->fl, NULL);
 
        return (error < 0)? nlm_lck_denied_nolocks : nlm_granted;