serial: fix NULL pointer dereference
[safe/jmp/linux-2.6] / include / linux / fscache-cache.h
index f3aa4bd..7be0c6f 100644 (file)
@@ -234,8 +234,10 @@ struct fscache_cache_ops {
        struct fscache_object *(*alloc_object)(struct fscache_cache *cache,
                                               struct fscache_cookie *cookie);
 
-       /* look up the object for a cookie */
-       void (*lookup_object)(struct fscache_object *object);
+       /* look up the object for a cookie
+        * - return -ETIMEDOUT to be requeued
+        */
+       int (*lookup_object)(struct fscache_object *object);
 
        /* finished looking up */
        void (*lookup_complete)(struct fscache_object *object);
@@ -317,6 +319,7 @@ struct fscache_cookie {
        void                            *netfs_data;    /* back pointer to netfs */
        struct radix_tree_root          stores;         /* pages to be stored on this cookie */
 #define FSCACHE_COOKIE_PENDING_TAG     0               /* pages tag: pending write to cache */
+#define FSCACHE_COOKIE_STORING_TAG     1               /* pages tag: writing to cache */
 
        unsigned long                   flags;
 #define FSCACHE_COOKIE_LOOKING_UP      0       /* T if non-index cookie being looked up still */
@@ -394,6 +397,7 @@ struct fscache_object {
        struct rb_node          objlist_link;   /* link in global object list */
 #endif
        pgoff_t                 store_limit;    /* current storage limit */
+       loff_t                  store_limit_l;  /* current storage limit */
 };
 
 extern const char *fscache_object_states[];
@@ -403,6 +407,10 @@ extern const char *fscache_object_states[];
         (obj)->state >= FSCACHE_OBJECT_AVAILABLE &&          \
         (obj)->state < FSCACHE_OBJECT_DYING)
 
+#define fscache_object_is_dead(obj)                            \
+       (test_bit(FSCACHE_IOERROR, &(obj)->cache->flags) &&     \
+        (obj)->state >= FSCACHE_OBJECT_DYING)
+
 extern const struct slow_work_ops fscache_object_slow_work_ops;
 
 /**
@@ -434,6 +442,7 @@ void fscache_object_init(struct fscache_object *object,
        object->events = object->event_mask = 0;
        object->flags = 0;
        object->store_limit = 0;
+       object->store_limit_l = 0;
        object->cache = cache;
        object->cookie = cookie;
        object->parent = NULL;
@@ -486,6 +495,7 @@ static inline void fscache_object_lookup_error(struct fscache_object *object)
 static inline
 void fscache_set_store_limit(struct fscache_object *object, loff_t i_size)
 {
+       object->store_limit_l = i_size;
        object->store_limit = i_size >> PAGE_SHIFT;
        if (i_size & ~PAGE_MASK)
                object->store_limit++;