You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2009/11/10 17:32:58 UTC

svn commit: r834533 - in /httpd/httpd/trunk: CHANGES modules/dav/fs/lock.c

Author: sf
Date: Tue Nov 10 16:32:57 2009
New Revision: 834533

URL: http://svn.apache.org/viewvc?rev=834533&view=rev
Log:
Revert removal of the key_type byte in the lock key. There is no need to break
the format on systems without inodes.

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/modules/dav/fs/lock.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=834533&r1=834532&r2=834533&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Tue Nov 10 16:32:57 2009
@@ -30,8 +30,9 @@
      old file if the transfer aborted. PR 39815. [Paul Querna, Stefan Fritsch]
 
   *) mod_dav_fs: Remove inode keyed locking as this conflicts with atomically
-     creating files. This is a format cange of the DavLockDB. The old
-     DavLockDB must be deleted on upgrade. [Stefan Fritsch]
+     creating files. On systems with inode numbers, this is a format cange of
+     the DavLockDB. The old DavLockDB must be deleted on upgrade.
+     [Stefan Fritsch]
 
   *) mod_log_config: Make ${cookie}C correctly match whole cookie names
      instead of substrings. PR 28037. [Dan Franklin <dan dan-franklin.com>,

Modified: httpd/httpd/trunk/modules/dav/fs/lock.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/dav/fs/lock.c?rev=834533&r1=834532&r2=834533&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/dav/fs/lock.c (original)
+++ httpd/httpd/trunk/modules/dav/fs/lock.c Tue Nov 10 16:32:57 2009
@@ -48,7 +48,8 @@
 **
 ** KEY
 **
-** The database is keyed by the full path.
+** The database is keyed by a key_type unsigned char (DAV_TYPE_FNAME)
+** followed by the full path. The key_type DAV_TYPE_INODE is not used anymore.
 **
 ** VALUE
 **
@@ -80,6 +81,12 @@
 #define DAV_LOCK_DIRECT         1
 #define DAV_LOCK_INDIRECT       2
 
+/*
+ * not used anymore
+ * #define DAV_TYPE_INODE          10
+ */
+#define DAV_TYPE_FNAME          11
+
 
 /* ack. forward declare. */
 static dav_error * dav_fs_remove_locknull_member(apr_pool_t *p,
@@ -379,8 +386,11 @@
     /* ### does this allocation have a proper lifetime? need to check */
     /* ### can we use a buffer for this? */
 
-    key.dsize = strlen(pathname) + 1;
-    key.dptr = apr_pstrmemdup(p, pathname, key.dsize - 1);
+    /* size is TYPE + pathname + null */
+    key.dsize = strlen(pathname) + 2;
+    key.dptr = apr_palloc(p, key.dsize);
+    *key.dptr = DAV_TYPE_FNAME;
+    memcpy(key.dptr + 1, pathname, key.dsize - 1);
     if (key.dptr[key.dsize - 2] == '/')
         key.dptr[--key.dsize - 1] = '\0';
     return key;
@@ -579,14 +589,15 @@
                 need_save = DAV_TRUE;
 
                 /* Remove timed-out locknull fm .locknull list */
-                {
+                if (*key.dptr == DAV_TYPE_FNAME) {
+                    const char *fname = key.dptr + 1;
                     apr_finfo_t finfo;
                     apr_status_t rv;
 
                     /* if we don't see the file, then it's a locknull */
-                    rv = apr_stat(&finfo, key.dptr, APR_FINFO_MIN | APR_FINFO_LINK, p);
+                    rv = apr_stat(&finfo, fname, APR_FINFO_MIN | APR_FINFO_LINK, p);
                     if (rv != APR_SUCCESS && rv != APR_INCOMPLETE) {
-                        if ((err = dav_fs_remove_locknull_member(p, key.dptr, &buf)) != NULL) {
+                        if ((err = dav_fs_remove_locknull_member(p, fname, &buf)) != NULL) {
                             /* ### push a higher-level description? */
                             return err;
                         }