@@ -189,7 +189,7 @@ static int ceph_releasepage(struct page *page, gfp_t g)
189189/*
190190 * read a single page, without unlocking it.
191191 */
192- static int readpage_nounlock (struct file * filp , struct page * page )
192+ static int ceph_do_readpage (struct file * filp , struct page * page )
193193{
194194 struct inode * inode = file_inode (filp );
195195 struct ceph_inode_info * ci = ceph_inode (inode );
@@ -219,7 +219,7 @@ static int readpage_nounlock(struct file *filp, struct page *page)
219219
220220 err = ceph_readpage_from_fscache (inode , page );
221221 if (err == 0 )
222- goto out ;
222+ return - EINPROGRESS ;
223223
224224 dout ("readpage inode %p file %p page %p index %lu\n" ,
225225 inode , filp , page , page -> index );
@@ -249,8 +249,11 @@ static int readpage_nounlock(struct file *filp, struct page *page)
249249
250250static int ceph_readpage (struct file * filp , struct page * page )
251251{
252- int r = readpage_nounlock (filp , page );
253- unlock_page (page );
252+ int r = ceph_do_readpage (filp , page );
253+ if (r != - EINPROGRESS )
254+ unlock_page (page );
255+ else
256+ r = 0 ;
254257 return r ;
255258}
256259
@@ -1094,7 +1097,7 @@ static int ceph_update_writeable_page(struct file *file,
10941097 goto retry_locked ;
10951098 r = writepage_nounlock (page , NULL );
10961099 if (r < 0 )
1097- goto fail_nosnap ;
1100+ goto fail_unlock ;
10981101 goto retry_locked ;
10991102 }
11001103
@@ -1122,11 +1125,14 @@ static int ceph_update_writeable_page(struct file *file,
11221125 }
11231126
11241127 /* we need to read it. */
1125- r = readpage_nounlock (file , page );
1126- if (r < 0 )
1127- goto fail_nosnap ;
1128+ r = ceph_do_readpage (file , page );
1129+ if (r < 0 ) {
1130+ if (r == - EINPROGRESS )
1131+ return - EAGAIN ;
1132+ goto fail_unlock ;
1133+ }
11281134 goto retry_locked ;
1129- fail_nosnap :
1135+ fail_unlock :
11301136 unlock_page (page );
11311137 return r ;
11321138}
0 commit comments