projects
/
yaffs2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
yaffs Fix readdir locking
[yaffs2.git]
/
yaffs_fs.c
diff --git
a/yaffs_fs.c
b/yaffs_fs.c
index 91d3a8170c7edaf9dac7833aaa57bfa9ff7a984a..031c390c11dc13b6fdcca92d54ea5c146ff5d38b 100644
(file)
--- a/
yaffs_fs.c
+++ b/
yaffs_fs.c
@@
-202,8
+202,12
@@
static int yaffs_file_flush(struct file *file, fl_owner_t id);
static int yaffs_file_flush(struct file *file);
#endif
static int yaffs_file_flush(struct file *file);
#endif
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
+static int yaffs_sync_object(struct file *file, int datasync);
+#else
static int yaffs_sync_object(struct file *file, struct dentry *dentry,
int datasync);
static int yaffs_sync_object(struct file *file, struct dentry *dentry,
int datasync);
+#endif
static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir);
static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir);
@@
-1438,7
+1442,7
@@
static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir)
sc = yaffs_NewSearch(obj);
if(!sc){
retVal = -ENOMEM;
sc = yaffs_NewSearch(obj);
if(!sc){
retVal = -ENOMEM;
- goto
unlock_
out;
+ goto out;
}
T(YAFFS_TRACE_OS, (TSTR("yaffs_readdir: starting at %d\n"), (int)offset));
}
T(YAFFS_TRACE_OS, (TSTR("yaffs_readdir: starting at %d\n"), (int)offset));
@@
-1448,8
+1452,10
@@
static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir)
(TSTR("yaffs_readdir: entry . ino %d \n"),
(int)inode->i_ino));
yaffs_GrossUnlock(dev);
(TSTR("yaffs_readdir: entry . ino %d \n"),
(int)inode->i_ino));
yaffs_GrossUnlock(dev);
- if (filldir(dirent, ".", 1, offset, inode->i_ino, DT_DIR) < 0)
+ if (filldir(dirent, ".", 1, offset, inode->i_ino, DT_DIR) < 0){
+ yaffs_GrossLock(dev);
goto out;
goto out;
+ }
yaffs_GrossLock(dev);
offset++;
f->f_pos++;
yaffs_GrossLock(dev);
offset++;
f->f_pos++;
@@
-1460,8
+1466,10
@@
static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir)
(int)f->f_dentry->d_parent->d_inode->i_ino));
yaffs_GrossUnlock(dev);
if (filldir(dirent, "..", 2, offset,
(int)f->f_dentry->d_parent->d_inode->i_ino));
yaffs_GrossUnlock(dev);
if (filldir(dirent, "..", 2, offset,
- f->f_dentry->d_parent->d_inode->i_ino, DT_DIR) < 0)
+ f->f_dentry->d_parent->d_inode->i_ino, DT_DIR) < 0){
+ yaffs_GrossLock(dev);
goto out;
goto out;
+ }
yaffs_GrossLock(dev);
offset++;
f->f_pos++;
yaffs_GrossLock(dev);
offset++;
f->f_pos++;
@@
-1497,8
+1505,10
@@
static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir)
strlen(name),
offset,
this_inode,
strlen(name),
offset,
this_inode,
- this_type) < 0)
+ this_type) < 0){
+ yaffs_GrossLock(dev);
goto out;
goto out;
+ }
yaffs_GrossLock(dev);
yaffs_GrossLock(dev);
@@
-1508,12
+1518,10
@@
static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir)
yaffs_SearchAdvance(sc);
}
yaffs_SearchAdvance(sc);
}
-unlock_out:
+out:
+ yaffs_EndSearch(sc);
yaffs_DeviceToContext(dev)->readdirProcess = NULL;
yaffs_DeviceToContext(dev)->readdirProcess = NULL;
-
yaffs_GrossUnlock(dev);
yaffs_GrossUnlock(dev);
-out:
- yaffs_EndSearch(sc);
return retVal;
}
return retVal;
}
@@
-1742,12
+1750,19
@@
static int yaffs_symlink(struct inode *dir, struct dentry *dentry,
return -ENOMEM;
}
return -ENOMEM;
}
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
+static int yaffs_sync_object(struct file *file, int datasync)
+#else
static int yaffs_sync_object(struct file *file, struct dentry *dentry,
int datasync)
static int yaffs_sync_object(struct file *file, struct dentry *dentry,
int datasync)
+#endif
{
yaffs_Object *obj;
yaffs_Device *dev;
{
yaffs_Object *obj;
yaffs_Device *dev;
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
+ struct dentry *dentry = file->f_path.dentry;
+#endif
obj = yaffs_DentryToObject(dentry);
obj = yaffs_DentryToObject(dentry);
@@
-1965,7
+1980,6
@@
ssize_t yaffs_listxattr(struct dentry *dentry, char *buff, size_t size)
if (error == 0) {
if (error == 0) {
- int result;
dev = obj->myDev;
yaffs_GrossLock(dev);
error = yaffs_ListXAttributes(obj, buff, size);
dev = obj->myDev;
yaffs_GrossLock(dev);
error = yaffs_ListXAttributes(obj, buff, size);
@@
-2217,7
+2231,7
@@
static int yaffs_BackgroundThread(void *data)
if(time_before(expires,now))
expires = now + HZ;
if(time_before(expires,now))
expires = now + HZ;
- init_timer(&timer);
+ init_timer
_on_stack
(&timer);
timer.expires = expires+1;
timer.data = (unsigned long) current;
timer.function = yaffs_background_waker;
timer.expires = expires+1;
timer.data = (unsigned long) current;
timer.function = yaffs_background_waker;