Whamcloud - gitweb
Branch: b1_4
authoradilger <adilger>
Wed, 6 Apr 2005 18:51:23 +0000 (18:51 +0000)
committeradilger <adilger>
Wed, 6 Apr 2005 18:51:23 +0000 (18:51 +0000)
Revert "last little bit of cleanup" for lli_size_sem locking.  Getting this
lock (a semaphore which can sleep) in ll_nopage and/or ll_ap_refresh_count
causes the client to lock up (symptoms include kupdated stuck, no free mem,
client unresponsive to network = elan timeouts).

Still need to figure proper locking solution here.  A spinlock is good for
all places except for ll_setattr_raw->vmtruncate path.

b=5654 (added under), b=6057, b=6059, b=6077 (possible fix)

lustre/llite/dir.c
lustre/llite/file.c
lustre/llite/llite_internal.h
lustre/llite/llite_mmap.c
lustre/llite/rw.c

index 63e09bc..d704cf0 100644 (file)
@@ -559,7 +559,7 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file,
 
                 ll_inode2fid(&fid, inode);
                 rc = mdc_getattr_name(sbi->ll_mdc_exp, &fid, filename,
-                                      strlen(filename)+1, OBD_MD_FLEASIZE,
+                                      strlen(filename) + 1, OBD_MD_FLEASIZE,
                                       obd_size_diskmd(sbi->ll_osc_exp, NULL),
                                       &request);
                 if (rc < 0) {
index aa9a996..66fdd1e 100644 (file)
@@ -697,7 +697,7 @@ int ll_extent_lock(struct ll_file_data *fd, struct inode *inode,
         /* don't drop the mmapped file to LRU */
         if (mapping_mapped(inode->i_mapping))
                 ast_flags |= LDLM_FL_NO_LRU;
-        
+
         /* XXX phil: can we do this?  won't it screw the file size up? */
         if ((fd && (fd->fd_flags & LL_FILE_IGNORE_LOCK)) ||
             (sbi->ll_flags & LL_SBI_NOLCK))
@@ -1112,8 +1112,8 @@ int ll_file_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
         /* We need to special case any other ioctls we want to handle,
          * to send them to the MDS/OST as appropriate and to properly
          * network encode the arg field.
-        case EXT2_IOC_SETVERSION_OLD:
-        case EXT2_IOC_SETVERSION_NEW:
+        case EXT3_IOC_SETVERSION_OLD:
+        case EXT3_IOC_SETVERSION:
         */
         default:
                 RETURN(obd_iocontrol(cmd, ll_i2obdexp(inode), 0, NULL,
@@ -1133,7 +1133,7 @@ loff_t ll_file_seek(struct file *file, loff_t offset, int origin)
                inode->i_ino, inode->i_generation, inode,
                offset + ((origin == 2) ? inode->i_size :
                          (origin == 1) ? file->f_pos : 0),
-               origin == 2 ? "SEEK_END": origin == 1 ? "SEEK_CUR": "SEEK_SET");
+               origin == 2 ? "SEEK_END": origin == 1 ? "SEEK_CUR" : "SEEK_SET");
 
         lprocfs_counter_incr(ll_i2sbi(inode)->ll_stats, LPROC_LL_LLSEEK);
         if (origin == 2) { /* SEEK_END */
index 4aa8183..7e19c00 100644 (file)
@@ -147,13 +147,13 @@ struct ll_readahead_state {
 };
 
 extern kmem_cache_t *ll_file_data_slab;
+struct lustre_handle;
 struct ll_file_data {
         struct obd_client_handle fd_mds_och;
         struct ll_readahead_state fd_ras;
         __u32 fd_flags;
 };
 
-struct lustre_handle;
 struct lov_stripe_md;
 
 extern spinlock_t inode_lock;
@@ -205,7 +205,7 @@ struct it_cb_data {
 extern kmem_cache_t *ll_async_page_slab;
 extern size_t ll_async_page_slab_size;
 struct ll_async_page {
-        int             llap_magic;
+        int              llap_magic;
         void            *llap_cookie;
         struct page     *llap_page;
         struct list_head llap_pending_write;
index e4d6670..995a7de 100644 (file)
@@ -358,7 +358,7 @@ struct page *ll_nopage(struct vm_area_struct *vma, unsigned long address,
                        int *type)
 #else
 struct page *ll_nopage(struct vm_area_struct *vma, unsigned long address,
-                       int type)
+                       int type /* unused */)
 #endif
 {
         struct file *filp = vma->vm_file;
@@ -398,17 +398,17 @@ struct page *ll_nopage(struct vm_area_struct *vma, unsigned long address,
 
         /* XXX change inode size without i_sem hold! there is a race condition
          *     with truncate path. (see ll_extent_lock) */
-        down(&lli->lli_size_sem);
+        //down(&lli->lli_size_sem);
         kms = lov_merge_size(lli->lli_smd, 1);
         pgoff = ((address - vma->vm_start) >> PAGE_CACHE_SHIFT) + vma->vm_pgoff;
         size = (kms + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
 
         if (pgoff >= size) {
-                up(&lli->lli_size_sem);
+                //up(&lli->lli_size_sem);
                 ll_glimpse_size(inode);
         } else {
                 inode->i_size = kms;
-                up(&lli->lli_size_sem);
+                //up(&lli->lli_size_sem);
         }
 
         /* disable VM_SEQ_READ and use VM_RAND_READ to make sure that
@@ -421,6 +421,8 @@ struct page *ll_nopage(struct vm_area_struct *vma, unsigned long address,
         vma->vm_flags |= VM_RAND_READ;
 
         page = filemap_nopage(vma, address, type);
+        LL_CDEBUG_PAGE(D_PAGE, page, "got addr %lu type %lx\n", address,
+                       (long)type);
         vma->vm_flags &= ~VM_RAND_READ;
         vma->vm_flags |= (rand_read | seq_read);
 
@@ -501,11 +503,9 @@ static int ll_populate(struct vm_area_struct *area, unsigned long address,
 #endif
 
 /* return the user space pointer that maps to a file offset via a vma */
-static inline unsigned long file_to_user(struct vm_area_struct *vma,
-                                         __u64 byte)
+static inline unsigned long file_to_user(struct vm_area_struct *vma, __u64 byte)
 {
-        return vma->vm_start +
-               (byte - ((__u64)vma->vm_pgoff << PAGE_SHIFT));
+        return vma->vm_start + (byte - ((__u64)vma->vm_pgoff << PAGE_SHIFT));
 
 }
 
index 0b008a5..6ca5b8c 100644 (file)
@@ -110,8 +110,8 @@ __u64 lov_merge_size(struct lov_stripe_md *lsm, int kms);
  * must be called with lli_size_sem held */
 void ll_truncate(struct inode *inode)
 {
-        struct lov_stripe_md *lsm = ll_i2info(inode)->lli_smd;
         struct ll_inode_info *lli = ll_i2info(inode);
+        struct lov_stripe_md *lsm = lli->lli_smd;
         struct obdo oa;
         int rc;
         ENTRY;
@@ -153,8 +153,7 @@ void ll_truncate(struct inode *inode)
         rc = obd_punch(ll_i2obdexp(inode), &oa, lsm, inode->i_size,
                        OBD_OBJECT_EOF, NULL);
         if (rc)
-                CERROR("obd_truncate fails (%d) ino %lu\n", rc,
-                       inode->i_ino);
+                CERROR("obd_truncate fails (%d) ino %lu\n", rc, inode->i_ino);
         else
                 obdo_to_inode(inode, &oa, OBD_MD_FLSIZE|OBD_MD_FLBLOCKS|
                               OBD_MD_FLATIME | OBD_MD_FLMTIME |
@@ -317,9 +316,9 @@ static int ll_ap_refresh_count(void *data, int cmd)
         lli = ll_i2info(page->mapping->host);
         lsm = lli->lli_smd;
 
-        down(&lli->lli_size_sem);
+        //down(&lli->lli_size_sem);
         kms = lov_merge_size(lsm, 1);
-        up(&lli->lli_size_sem);
+        //up(&lli->lli_size_sem);
 
         /* catch race with truncate */
         if (((__u64)page->index << PAGE_SHIFT) >= kms)
@@ -1130,6 +1129,7 @@ out_unlock:
         spin_unlock(&sbi->ll_lock);
         return;
 }
+
 int ll_writepage(struct page *page)
 {
         struct inode *inode = page->mapping->host;
@@ -1153,7 +1153,7 @@ int ll_writepage(struct page *page)
         page_cache_get(page);
         if (llap->llap_write_queued) {
                 LL_CDEBUG_PAGE(D_PAGE, page, "marking urgent\n");
-                rc = obd_set_async_flags(exp, ll_i2info(inode)->lli_smd, NULL,
+                rc = obd_set_async_flags(exp, lli->lli_smd, NULL,
                                          llap->llap_cookie,
                                          ASYNC_READY | ASYNC_URGENT);
         } else {