@@ -128,28 +128,27 @@ static struct inode *nfs_layout_find_inode_by_stateid(struct nfs_client *clp,
128
128
struct inode * inode ;
129
129
struct pnfs_layout_hdr * lo ;
130
130
131
- restart :
132
131
list_for_each_entry_rcu (server , & clp -> cl_superblocks , client_link ) {
133
132
list_for_each_entry (lo , & server -> layouts , plh_layouts ) {
134
133
if (stateid != NULL &&
135
134
!nfs4_stateid_match_other (stateid , & lo -> plh_stateid ))
136
135
continue ;
137
136
inode = igrab (lo -> plh_inode );
138
137
if (!inode )
139
- continue ;
138
+ return ERR_PTR ( - EAGAIN ) ;
140
139
if (!nfs_sb_active (inode -> i_sb )) {
141
140
rcu_read_unlock ();
142
141
spin_unlock (& clp -> cl_lock );
143
142
iput (inode );
144
143
spin_lock (& clp -> cl_lock );
145
144
rcu_read_lock ();
146
- goto restart ;
145
+ return ERR_PTR ( - EAGAIN ) ;
147
146
}
148
147
return inode ;
149
148
}
150
149
}
151
150
152
- return NULL ;
151
+ return ERR_PTR ( - ENOENT ) ;
153
152
}
154
153
155
154
/*
@@ -166,7 +165,6 @@ static struct inode *nfs_layout_find_inode_by_fh(struct nfs_client *clp,
166
165
struct inode * inode ;
167
166
struct pnfs_layout_hdr * lo ;
168
167
169
- restart :
170
168
list_for_each_entry_rcu (server , & clp -> cl_superblocks , client_link ) {
171
169
list_for_each_entry (lo , & server -> layouts , plh_layouts ) {
172
170
nfsi = NFS_I (lo -> plh_inode );
@@ -176,20 +174,20 @@ static struct inode *nfs_layout_find_inode_by_fh(struct nfs_client *clp,
176
174
continue ;
177
175
inode = igrab (lo -> plh_inode );
178
176
if (!inode )
179
- continue ;
177
+ return ERR_PTR ( - EAGAIN ) ;
180
178
if (!nfs_sb_active (inode -> i_sb )) {
181
179
rcu_read_unlock ();
182
180
spin_unlock (& clp -> cl_lock );
183
181
iput (inode );
184
182
spin_lock (& clp -> cl_lock );
185
183
rcu_read_lock ();
186
- goto restart ;
184
+ return ERR_PTR ( - EAGAIN ) ;
187
185
}
188
186
return inode ;
189
187
}
190
188
}
191
189
192
- return NULL ;
190
+ return ERR_PTR ( - ENOENT ) ;
193
191
}
194
192
195
193
static struct inode * nfs_layout_find_inode (struct nfs_client * clp ,
@@ -201,7 +199,7 @@ static struct inode *nfs_layout_find_inode(struct nfs_client *clp,
201
199
spin_lock (& clp -> cl_lock );
202
200
rcu_read_lock ();
203
201
inode = nfs_layout_find_inode_by_stateid (clp , stateid );
204
- if (! inode )
202
+ if (inode == ERR_PTR ( - ENOENT ) )
205
203
inode = nfs_layout_find_inode_by_fh (clp , fh );
206
204
rcu_read_unlock ();
207
205
spin_unlock (& clp -> cl_lock );
@@ -256,8 +254,11 @@ static u32 initiate_file_draining(struct nfs_client *clp,
256
254
LIST_HEAD (free_me_list );
257
255
258
256
ino = nfs_layout_find_inode (clp , & args -> cbl_fh , & args -> cbl_stateid );
259
- if (!ino )
260
- goto out ;
257
+ if (IS_ERR (ino )) {
258
+ if (ino == ERR_PTR (- EAGAIN ))
259
+ rv = NFS4ERR_DELAY ;
260
+ goto out_noput ;
261
+ }
261
262
262
263
pnfs_layoutcommit_inode (ino , false);
263
264
@@ -303,9 +304,10 @@ static u32 initiate_file_draining(struct nfs_client *clp,
303
304
nfs_commit_inode (ino , 0 );
304
305
pnfs_put_layout_hdr (lo );
305
306
out :
307
+ nfs_iput_and_deactive (ino );
308
+ out_noput :
306
309
trace_nfs4_cb_layoutrecall_file (clp , & args -> cbl_fh , ino ,
307
310
& args -> cbl_stateid , - rv );
308
- nfs_iput_and_deactive (ino );
309
311
return rv ;
310
312
}
311
313
0 commit comments