Accepting request 36638 from Base:System
Copy from Base:System/rpm based on submit request 36638 from user oertel OBS-URL: https://build.opensuse.org/request/show/36638 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/rpm?expand=0&rev=95
This commit is contained in:
committed by
Git OBS Bridge
parent
d210f61336
commit
bd93352974
125
suspendlock.diff
125
suspendlock.diff
@@ -5,64 +5,9 @@ locking.
|
||||
I hijacked the dbiSync function for this because I did not want
|
||||
to change the ABI.
|
||||
|
||||
Index: lib/psm.c
|
||||
===================================================================
|
||||
--- lib/psm.c.orig
|
||||
+++ lib/psm.c
|
||||
@@ -756,6 +756,8 @@ static rpmRC runScript(rpmpsm psm, Heade
|
||||
goto exit;
|
||||
}
|
||||
|
||||
+ rpmtsSuspendResumeDBLock(psm->ts, 0);
|
||||
+
|
||||
xx = rpmsqFork(&psm->sq);
|
||||
if (psm->sq.child == 0) {
|
||||
rpmlog(RPMLOG_DEBUG, "%s: %s\texecv(%s) pid %d\n",
|
||||
@@ -770,6 +772,8 @@ static rpmRC runScript(rpmpsm psm, Heade
|
||||
|
||||
(void) psmWait(psm);
|
||||
|
||||
+ rpmtsSuspendResumeDBLock(psm->ts, 1);
|
||||
+
|
||||
if (psm->sq.reaped < 0) {
|
||||
rpmlog(RPMLOG_ERR, _("%s scriptlet failed, waitpid(%d) rc %d: %s\n"),
|
||||
sname, psm->sq.child, psm->sq.reaped, strerror(errno));
|
||||
Index: lib/rpmts.c
|
||||
===================================================================
|
||||
--- lib/rpmts.c.orig
|
||||
+++ lib/rpmts.c
|
||||
@@ -108,6 +108,11 @@ int rpmtsOpenDB(rpmts ts, int dbmode)
|
||||
return rc;
|
||||
}
|
||||
|
||||
+int rpmtsSuspendResumeDBLock(rpmts ts, int mode)
|
||||
+{
|
||||
+ return rpmdbSuspendResumeDBLock(ts->rdb, mode);
|
||||
+}
|
||||
+
|
||||
int rpmtsInitDB(rpmts ts, int dbmode)
|
||||
{
|
||||
void *lock = rpmtsAcquireLock(ts);
|
||||
Index: lib/rpmts.h
|
||||
===================================================================
|
||||
--- lib/rpmts.h.orig
|
||||
+++ lib/rpmts.h
|
||||
@@ -472,6 +472,10 @@ rpmdb rpmtsGetRdb(rpmts ts);
|
||||
*/
|
||||
int rpmtsInitDSI(const rpmts ts);
|
||||
|
||||
+int rpmtsSuspendResumeDBLock(rpmts ts, int mode)
|
||||
+ /*@globals fileSystem @*/
|
||||
+ /*@modifies fileSystem @*/;
|
||||
+
|
||||
/** \ingroup rpmts
|
||||
* Update disk space info for a file.
|
||||
* @param ts transaction set
|
||||
Index: lib/backend/db3.c
|
||||
===================================================================
|
||||
--- lib/backend/db3.c.orig
|
||||
+++ lib/backend/db3.c
|
||||
@@ -398,12 +398,18 @@ errxit:
|
||||
--- ./lib/backend/db3.c.orig 2010-03-25 14:35:39.000000000 +0000
|
||||
+++ ./lib/backend/db3.c 2010-03-25 14:44:42.000000000 +0000
|
||||
@@ -208,11 +208,17 @@ errxit:
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -72,16 +17,15 @@ Index: lib/backend/db3.c
|
||||
{
|
||||
DB * db = dbi->dbi_db;
|
||||
int rc = 0;
|
||||
int _printit;
|
||||
|
||||
+ if (flags == (unsigned int)-1)
|
||||
+ return db3SuspendResumeLock(dbi, 0);
|
||||
+ if (flags == (unsigned int)-2)
|
||||
+ return db3SuspendResumeLock(dbi, 1);
|
||||
if (db != NULL)
|
||||
if (db != NULL) {
|
||||
rc = db->sync(db, flags);
|
||||
/* XXX DB_INCOMPLETE is returned occaisionally with multiple access. */
|
||||
@@ -1122,6 +1128,50 @@ static int db3open(rpmdb rpmdb, rpmTag r
|
||||
rc = cvtdberr(dbi, "db->sync", rc, _debug);
|
||||
@@ -848,6 +854,48 @@ static int db3open(rpmdb rpmdb, rpmTag r
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -97,8 +41,6 @@ Index: lib/backend/db3.c
|
||||
+ return 0;
|
||||
+ if (!(dbi->dbi_mode & (O_RDWR|O_WRONLY)))
|
||||
+ return 0;
|
||||
+ if ((dbi->dbi_ecflags & DB_CLIENT) && dbi->dbi_host)
|
||||
+ return 0;
|
||||
+ if (dbi->dbi_use_dbenv && _lockdbfd == 0)
|
||||
+ return 0;
|
||||
+ if (!(dbi->dbi_db->fd(dbi->dbi_db, &fdno) == 0 && fdno >= 0))
|
||||
@@ -132,11 +74,29 @@ Index: lib/backend/db3.c
|
||||
/** \ingroup db3
|
||||
*/
|
||||
RPM_GNUC_INTERNAL
|
||||
Index: lib/rpmdb.c
|
||||
===================================================================
|
||||
--- lib/rpmdb.c.orig
|
||||
+++ lib/rpmdb.c
|
||||
@@ -886,6 +886,21 @@ int rpmdbSync(rpmdb db)
|
||||
--- ./lib/psm.c.orig 2010-03-25 14:43:29.000000000 +0000
|
||||
+++ ./lib/psm.c 2010-03-25 14:43:41.000000000 +0000
|
||||
@@ -754,6 +754,8 @@ static rpmRC runScript(rpmpsm psm, Heade
|
||||
goto exit;
|
||||
}
|
||||
|
||||
+ rpmtsSuspendResumeDBLock(psm->ts, 0);
|
||||
+
|
||||
xx = rpmsqFork(&psm->sq);
|
||||
if (psm->sq.child == 0) {
|
||||
rpmlog(RPMLOG_DEBUG, "%s: %s\texecv(%s) pid %d\n",
|
||||
@@ -768,6 +770,8 @@ static rpmRC runScript(rpmpsm psm, Heade
|
||||
|
||||
(void) psmWait(psm);
|
||||
|
||||
+ rpmtsSuspendResumeDBLock(psm->ts, 1);
|
||||
+
|
||||
if (psm->sq.reaped < 0) {
|
||||
rpmlog(RPMLOG_ERR, _("%s scriptlet failed, waitpid(%d) rc %d: %s\n"),
|
||||
sname, psm->sq.child, psm->sq.reaped, strerror(errno));
|
||||
--- ./lib/rpmdb.c.orig 2010-03-25 14:36:57.000000000 +0000
|
||||
+++ ./lib/rpmdb.c 2010-03-25 14:43:41.000000000 +0000
|
||||
@@ -903,6 +903,21 @@ int rpmdbSync(rpmdb db)
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -158,3 +118,30 @@ Index: lib/rpmdb.c
|
||||
/* FIX: dbTemplate structure assignment */
|
||||
static
|
||||
rpmdb newRpmdb(const char * root,
|
||||
--- ./lib/rpmts.c.orig 2009-12-17 09:05:37.000000000 +0000
|
||||
+++ ./lib/rpmts.c 2010-03-25 14:43:41.000000000 +0000
|
||||
@@ -89,6 +89,11 @@ int rpmtsOpenDB(rpmts ts, int dbmode)
|
||||
return rc;
|
||||
}
|
||||
|
||||
+int rpmtsSuspendResumeDBLock(rpmts ts, int mode)
|
||||
+{
|
||||
+ return rpmdbSuspendResumeDBLock(ts->rdb, mode);
|
||||
+}
|
||||
+
|
||||
int rpmtsInitDB(rpmts ts, int dbmode)
|
||||
{
|
||||
void *lock = rpmtsAcquireLock(ts);
|
||||
--- ./lib/rpmts.h.orig 2009-12-17 09:05:37.000000000 +0000
|
||||
+++ ./lib/rpmts.h 2010-03-25 14:43:41.000000000 +0000
|
||||
@@ -469,6 +469,10 @@ rpmdb rpmtsGetRdb(rpmts ts);
|
||||
void * rpmtsNotify(rpmts ts, rpmte te,
|
||||
rpmCallbackType what, rpm_loff_t amount, rpm_loff_t total);
|
||||
|
||||
+int rpmtsSuspendResumeDBLock(rpmts ts, int mode)
|
||||
+ /*@globals fileSystem @*/
|
||||
+ /*@modifies fileSystem @*/;
|
||||
+
|
||||
/** \ingroup rpmts
|
||||
* Return number of (ordered) transaction set elements.
|
||||
* @param ts transaction set
|
||||
|
Reference in New Issue
Block a user