svn commit: linux-cifs-client r37 - in
branches/SOC/linux-2.6bk-dnotify/fs/cifs: .
asser at samba.org
asser at samba.org
Tue Aug 23 13:12:33 GMT 2005
Author: asser
Date: 2005-08-23 13:12:32 +0000 (Tue, 23 Aug 2005)
New Revision: 37
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=linux-cifs-client&rev=37
Log:
Implemented cancellation of the notify request when arg = 0
Modified:
branches/SOC/linux-2.6bk-dnotify/fs/cifs/fcntl.c
Changeset:
Modified: branches/SOC/linux-2.6bk-dnotify/fs/cifs/fcntl.c
===================================================================
--- branches/SOC/linux-2.6bk-dnotify/fs/cifs/fcntl.c 2005-08-23 13:11:27 UTC (rev 36)
+++ branches/SOC/linux-2.6bk-dnotify/fs/cifs/fcntl.c 2005-08-23 13:12:32 UTC (rev 37)
@@ -73,6 +73,8 @@
char *full_path = NULL;
__u32 filter = FILE_NOTIFY_CHANGE_NAME | FILE_NOTIFY_CHANGE_ATTRIBUTES;
__u16 netfid;
+ struct dir_notify_req *dnotify_req;
+ struct list_head *tmp, *tmp1;
xid = GetXid();
cifs_sb = CIFS_SB(file->f_dentry->d_sb);
@@ -86,28 +88,50 @@
rc = -ENOMEM;
} else {
cERROR(1,("cifs dir notify on file %s with arg 0x%lx (cifs arg 0x%lx)",full_path,arg,(unsigned long)convert_to_cifs_notify_flags(arg))); /* BB removeme BB */
- rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN,
- GENERIC_READ | SYNCHRONIZE, 0 /* create options */,
- &netfid, &oplock,NULL, cifs_sb->local_nls,
- cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
- /* BB fixme - add this handle to a notify handle list */
- if(rc) {
- cERROR(1,("Could not open directory for notify")); /* BB remove BB */
+
+ if(arg == 0) {
+ cFYI(1,("arg = 0, cancelling notification on %s",full_path));
+ /* arg = 0 means cancel the notification */
+ spin_lock(&GlobalMid_Lock);
+ list_for_each_safe(tmp, tmp1, &GlobalDnotifyReqList) {
+ dnotify_req = list_entry(tmp, struct dir_notify_req, lhead);
+
+ if(dnotify_req->dentry == file->f_dentry) {
+ rc = CIFSSMBCancel(xid, pTcon, dnotify_req->Uid, dnotify_req->Pid,
+ dnotify_req->PidHigh, dnotify_req->Tid, dnotify_req->Mid);
+
+ cFYI(1,("Error in CIFSSMBCancel = %d", rc));
+ if(rc) {
+ cFYI(1,("Error in CIFSSMBCancel = %d", rc));
+ }
+ list_del(tmp);
+ }
+ }
+ spin_unlock(&GlobalMid_Lock);
} else {
- filter = convert_to_cifs_notify_flags(arg);
- if(filter != 0) {
- rc = CIFSSMBNotify(xid, pTcon, 0 /* no subdirs */, netfid,
- filter, cifs_sb->local_nls, file->f_dentry, arg & DN_MULTISHOT);
+ rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN,
+ GENERIC_READ | SYNCHRONIZE, 0 /* create options */,
+ &netfid, &oplock,NULL, cifs_sb->local_nls,
+ cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
+ /* BB fixme - add this handle to a notify handle list */
+ if(rc) {
+ cERROR(1,("Could not open directory for notify")); /* BB remove BB */
+ } else {
+ filter = convert_to_cifs_notify_flags(arg);
+ if(filter != 0) {
+ rc = CIFSSMBNotify(xid, pTcon, 0 /* no subdirs */, netfid,
+ filter, cifs_sb->local_nls, file->f_dentry, arg & DN_MULTISHOT);
- } else {
- /* ASF TODO: Close the file handle */
- rc = -EINVAL;
+ } else {
+ /* ASF TODO: Close the file handle */
+ rc = -EINVAL;
+ }
+ /* BB add code to close file eventually (at unmount
+ it would close automatically but may be a way
+ to do it easily when inode freed or when
+ notify info is cleared/changed */
+ cERROR(1,("notify rc %d",rc));
}
- /* BB add code to close file eventually (at unmount
- it would close automatically but may be a way
- to do it easily when inode freed or when
- notify info is cleared/changed */
- cERROR(1,("notify rc %d",rc));
}
}
More information about the samba-cvs
mailing list