caps.c (ff5d913dfc7142974eb1694d5fd6284658e46bc6) caps.c (81f148a910045cd0a139f589a0b42764b172f8f5)
1// SPDX-License-Identifier: GPL-2.0
2#include <linux/ceph/ceph_debug.h>
3
4#include <linux/fs.h>
5#include <linux/kernel.h>
6#include <linux/sched/signal.h>
7#include <linux/slab.h>
8#include <linux/vmalloc.h>

--- 2766 unchanged lines hidden (view full) ---

2775 * ask the mds) so we don't get hung up indefinitely.
2776 */
2777int ceph_get_caps(struct file *filp, int need, int want,
2778 loff_t endoff, int *got, struct page **pinned_page)
2779{
2780 struct ceph_file_info *fi = filp->private_data;
2781 struct inode *inode = file_inode(filp);
2782 struct ceph_inode_info *ci = ceph_inode(inode);
1// SPDX-License-Identifier: GPL-2.0
2#include <linux/ceph/ceph_debug.h>
3
4#include <linux/fs.h>
5#include <linux/kernel.h>
6#include <linux/sched/signal.h>
7#include <linux/slab.h>
8#include <linux/vmalloc.h>

--- 2766 unchanged lines hidden (view full) ---

2775 * ask the mds) so we don't get hung up indefinitely.
2776 */
2777int ceph_get_caps(struct file *filp, int need, int want,
2778 loff_t endoff, int *got, struct page **pinned_page)
2779{
2780 struct ceph_file_info *fi = filp->private_data;
2781 struct inode *inode = file_inode(filp);
2782 struct ceph_inode_info *ci = ceph_inode(inode);
2783 struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
2783 int ret, _got, flags;
2784
2785 ret = ceph_pool_perm_check(inode, need);
2786 if (ret < 0)
2787 return ret;
2788
2784 int ret, _got, flags;
2785
2786 ret = ceph_pool_perm_check(inode, need);
2787 if (ret < 0)
2788 return ret;
2789
2790 if ((fi->fmode & CEPH_FILE_MODE_WR) &&
2791 fi->filp_gen != READ_ONCE(fsc->filp_gen))
2792 return -EBADF;
2793
2789 while (true) {
2790 if (endoff > 0)
2791 check_max_size(inode, endoff);
2792
2793 flags = atomic_read(&fi->num_locks) ? CHECK_FILELOCK : 0;
2794 _got = 0;
2795 ret = try_get_cap_refs(inode, need, want, endoff,
2796 flags, &_got);

--- 12 unchanged lines hidden (view full) ---

2809 }
2810 wait_woken(&wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);
2811 }
2812
2813 remove_wait_queue(&ci->i_cap_wq, &wait);
2814 if (ret == -EAGAIN)
2815 continue;
2816 }
2794 while (true) {
2795 if (endoff > 0)
2796 check_max_size(inode, endoff);
2797
2798 flags = atomic_read(&fi->num_locks) ? CHECK_FILELOCK : 0;
2799 _got = 0;
2800 ret = try_get_cap_refs(inode, need, want, endoff,
2801 flags, &_got);

--- 12 unchanged lines hidden (view full) ---

2814 }
2815 wait_woken(&wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);
2816 }
2817
2818 remove_wait_queue(&ci->i_cap_wq, &wait);
2819 if (ret == -EAGAIN)
2820 continue;
2821 }
2822
2823 if ((fi->fmode & CEPH_FILE_MODE_WR) &&
2824 fi->filp_gen != READ_ONCE(fsc->filp_gen)) {
2825 if (ret >= 0 && _got)
2826 ceph_put_cap_refs(ci, _got);
2827 return -EBADF;
2828 }
2829
2817 if (ret < 0) {
2818 if (ret == -ESTALE) {
2819 /* session was killed, try renew caps */
2820 ret = ceph_renew_caps(inode);
2821 if (ret == 0)
2822 continue;
2823 }
2824 return ret;

--- 1476 unchanged lines hidden ---
2830 if (ret < 0) {
2831 if (ret == -ESTALE) {
2832 /* session was killed, try renew caps */
2833 ret = ceph_renew_caps(inode);
2834 if (ret == 0)
2835 continue;
2836 }
2837 return ret;

--- 1476 unchanged lines hidden ---