FS-Cache: Make sure FSCACHE_COOKIE_LOOKING_UP cleared on lookup failure
We must make sure that FSCACHE_COOKIE_LOOKING_UP is cleared on lookup failure (if an object reaches the LC_DYING state), and we should clear it before clearing FSCACHE_COOKIE_CREATING. If this doesn't happen then fscache_wait_for_deferred_lookup() may hold allocation and retrieval operations indefinitely until they're interrupted by signals - which in turn pins the dying object until they go away. Signed-off-by: David Howells <dhowells@redhat.com>
This commit is contained in:
		
					parent
					
						
							
								2175bb06dc
							
						
					
				
			
			
				commit
				
					
						d461d26dde
					
				
			
		
					 1 changed files with 12 additions and 5 deletions
				
			
		| 
						 | 
					@ -105,6 +105,7 @@ static inline void fscache_done_parent_op(struct fscache_object *object)
 | 
				
			||||||
static void fscache_object_state_machine(struct fscache_object *object)
 | 
					static void fscache_object_state_machine(struct fscache_object *object)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	enum fscache_object_state new_state;
 | 
						enum fscache_object_state new_state;
 | 
				
			||||||
 | 
						struct fscache_cookie *cookie;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ASSERT(object != NULL);
 | 
						ASSERT(object != NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -158,11 +159,17 @@ static void fscache_object_state_machine(struct fscache_object *object)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		spin_lock(&object->lock);
 | 
							spin_lock(&object->lock);
 | 
				
			||||||
		object->state = FSCACHE_OBJECT_DYING;
 | 
							object->state = FSCACHE_OBJECT_DYING;
 | 
				
			||||||
		if (object->cookie &&
 | 
							cookie = object->cookie;
 | 
				
			||||||
		    test_and_clear_bit(FSCACHE_COOKIE_CREATING,
 | 
							if (cookie) {
 | 
				
			||||||
				       &object->cookie->flags))
 | 
								if (test_and_clear_bit(FSCACHE_COOKIE_LOOKING_UP,
 | 
				
			||||||
			wake_up_bit(&object->cookie->flags,
 | 
										       &cookie->flags))
 | 
				
			||||||
				    FSCACHE_COOKIE_CREATING);
 | 
									wake_up_bit(&cookie->flags,
 | 
				
			||||||
 | 
										    FSCACHE_COOKIE_LOOKING_UP);
 | 
				
			||||||
 | 
								if (test_and_clear_bit(FSCACHE_COOKIE_CREATING,
 | 
				
			||||||
 | 
										       &cookie->flags))
 | 
				
			||||||
 | 
									wake_up_bit(&cookie->flags,
 | 
				
			||||||
 | 
										    FSCACHE_COOKIE_CREATING);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		spin_unlock(&object->lock);
 | 
							spin_unlock(&object->lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		fscache_done_parent_op(object);
 | 
							fscache_done_parent_op(object);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue